Tuesday, 29 November 2016

Resize LVM in Centos 7 using gparted

Boot into gparted ISO and resize your partition to the desired size.

Apply the changes and boot into regular Centos.

Use 

vgdisplay | grep "Free  PE" 

to view the free space and note the first value which is the number of free blocks


lvdisplay | egrep 'Path|Size'
  LV Path                /dev/centos/swap
  LV Size                1.60 GiB
  LV Path                /dev/centos/root

  LV Size                77.91 GiB

Note the partition name you want to expand

Now we need to extend the LV

lvextend -l+<number of blocks> <partition to be grown>

e.g.
lvextend -l+4222 /dev/centos/root


Finally, you need to extend the xfs file system to match the partition

fsadm resize <partition to be grown>

e.g.
fsadm resize /dev/centos/root