0

I've a problem with increasing a partition from 20GB to 120GB, VMDK file. Here is what I've done:

  1. using vmware-diskmanager to increase vmdk file from 20 GB - 120 GB. It's ok.
  2. download and boot from GParted Live CD and expand /dev/sda1 from 20 GB - 120 GB.

However, when I reboot and log in, I still see that the "/" partition is still ~ 20GB (I'm using Centos 7). I've another partition disk (ext4: /dev/sdb: 150GB). Here is the fdisk list:

Disk /dev/sdb: 161.1 GB
Disk /dev/sda: 128.8 GB
Disk /dev/mapper/centos-swap: 2147 MB
Disk /dev/mapper/centos-root: 126.2GB

How can Centos 7 see the actual size of partition "/" (/dev/sda). I think /dev/mapper is /dev/sda.

Thanks

Result of df:

df
Filesystem              1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root  18348032 8037960  10310072  44% /
devtmpfs                   930184       0    930184   0% /dev
tmpfs                      939228     172    939056   1% /dev/shm
tmpfs                      939228    9080    930148   1% /run
tmpfs                      939228       0    939228   0% /sys/fs/cgroup
/dev/sda1                  508588  162520    346068  32% /boot
/dev/sr0                   227018  227018         0 100% /run/media/root
/GParted-live
2
  • can you provide the result of df ?
    – Archemar
    Mar 16, 2015 at 8:27
  • Here is the result of df: df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 18348032 8037960 10310072 44% / devtmpfs 930184 0 930184 0% /dev tmpfs 939228 172 939056 1% /dev/shm tmpfs 939228 9080 930148 1% /run tmpfs 939228 0 939228 0% /sys/fs/cgroup /dev/sda1 508588 162520 346068 32% /boot /dev/sr0 227018 227018 0 100% /run/media/root/GParted-live Mar 16, 2015 at 8:57

1 Answer 1

3

I believe your system is using LVM. And it seems GParted is not able to expand the logical volume. But you can do it manually. Just boot your system as normal, then from a terminal window do:

sudo lvextend -L+20G -r /dev/mapper/centos-root # resize the LV and the underlying fs

(If you are running as root in the terminal then you don't need sudo.) This command expands the logical volume by 20G (you could specify something different or use a percentage e.g. -L100% - though it's good to leave some spare e.g. for snapshots), and the -r option expands the filesystem inside the logical volume.

6
  • I cannot run the second command because it cannot find the /dev/mappper/centos-root Mar 16, 2015 at 9:44
  • Thanks gogoud, but when I try sudo lvextend -L+20G -r /dev/mapper/centos-root in Gparted live CD, it notices me that "Logical volume root must be activated before resizing filesystem". Mar 16, 2015 at 9:56
  • ok I amended the answer to put in the activation command (SystemRescueCD would have activated it at boot, I guess GParted LiveCD doesn't)
    – gogoud
    Mar 16, 2015 at 10:28
  • and further amended cos it turns out you can do this on a live fs, so you don't need to run it from the GParted LiveCD, you can just do it from within the normal machine. Pretty cool being able to resize a live root filesystem on the fly. And in this case activation is not needed (because the LV is already active).
    – gogoud
    Mar 16, 2015 at 10:37
  • It's done now, thanks you gogoud. It's quite simple, because the file system of Centos 7 is xfs so use the command xfs_growfs /dev/centos/root is ok. Anw, I'm really thanks for your help. Mar 16, 2015 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .