HOWTO: LVM - Resizing Logical Volume (Extend and Reduce)

On-line re-sizing of Logical Volume


check the size


df -h /share


verify there are free "Physical Extents available"
vgdisplay vg00


extend the logical volume using extents "using size not recommended"
lvextend -l +128 /dev/vg00/disk00


grow the mounted file system of /share


resize2fs -p /dev/vg00/disk00


-p * display the progress


Note: Before you make any changes make sure you backup all data on the logical partition that you want to extend.


Off-line reducing of Logical Volume

WARNING: Make sure you have a solid backup before resizing. wrong command will destroy all your data

Unmount the logical partition
umount /share

check the disk first for any error
fsck -f /dev/mapper/vg00-disk00

resize the file system to 10G (disk00 is 16G size)
resize2fs -p /dev/mapper/vg00-disk00 10G

* Note specifying size will use the logical extents

Reduce the logical volume 
lvreduce -L 10G /dev/mapper/vg00-disk00

* Note make sure your logical volume size is bigger or equal to the files system you specify above on resizing file system.

Finally, mount the Logical partition
mount /dev/mapper/vg00-disk00 /share

check the size
df -h /share

Comments