Centos – How to extend VMware Partition on Centos 7 using GParted

centosfdiskgpartedpartitionvmware

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

Best Answer

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.

Related Question