Linux : Expanding LVM and growing partition

By | August 14, 2015

One of the interesting and main feature of LVM is the flexibility of shrinking or growing volumes. Follow theses easy steps :

NOTE : Steps 1 to 3 are only needed if your physical volume (PV) is full or need more space. You should jump to step 4 if you just need to grow a logical volume.

1. Deactivate the physical volume

vgchange -a n VG

2. Grow the physical volume :

pvresize PV

3. Activate the physical volume :

vgchange -a y PV

4. Extend the logical volume (assuming we want to grow it up to 100 Gb) :

lvextend -L 102400M /dev/mapper/vg_server_vd1-LogVol01

5. Resize the filesystem (assuming the partition is ext2/3/4 formatted) :

resize2fs /dev/mapper/vg_server_vd1-LogVol01

Disclaimer : This process should be safe to do and can be performed live, but I would certainly do not manipulate the filesystem without a backup!