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.
Then Go ahead and run these commands to extend the LVM volume on Linux host.
First check the existing partitions
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)
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
# lvextend -l +2560 /dev/mapper/VolGroup01-var_lv
# lvextend -L+1GB /dev/mapper/VolGroup01-var_lv (For specific size extension)
And then resize the partition (using FRE 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.