Resize LVM disk after extending Virtual Machine disk (vmdk)

by | Feb 5, 2017 | VMWare

Follow these simple steps to resize a Virtual machine disk (vmdk) and then extend the volume using LVM. Make sure that you have/make a backup before carrying out these steps. First go ahead and extend the vmdk from ESXi/vCenter. I increased the disk size from 20GB–>>30GB.

Before

After

Then Go ahead and run these commands to extend the LVM volume on Linux host.

First check the existing partitions

# lsblk

Note: If new size is not visible, Run a re-scan of iscsi bus

# ls /sys/class/scsi_disk/
# echo "1" > /sys/class/scsi_disk/2:0:2:0/device/rescan

Note: as it’s the 2nd disk = sdb, scan the 2nd entry

Now resize the physical volume

# pvresize /dev/sdb

Check the FREE PE (Physical Extents)

# pvdisplay

Take a note of the PE and use it to extend the partition. I want to extend the var_lv as displayed below.

# df -h | grep var

Now extend

# lvextend -l +2560 /dev/mapper/VolGroup01-var_lv

(OR)

# lvextend -L+1GB /dev/mapper/VolGroup01-var_lv #(For specific size extension)

And then resize the partition (using FREE PE).

# resize2fs /dev/mapper/VolGroup01-var_lv

And that’s it you should up and running with the extra space with no downtime required or data loss as its LVM.

Related Articles….