File System Extension on Live Linux VMware Guest using vmdisk size extended

Many thanks to RAM for this Article.


This article explains, Filesystem extension on live Linux VMware Linux Guest where vmdisk size is extended and by not new disk added.

We had a scenario as follows:

1.       File system extension requirement on a live mounted file system without reboot.
2.       It’s a Linux guest on VMware required a FS extension from 600 GB to 900 GB. The FS was a single 600 GB disk  /dev/sdb
3.       While assigning storage, the team did increase the underlying disk to 900 GB than adding a new disk.
4.       Even after extension,  /dev/sdb was not picking up the additional 300 GB space. [ rescan or partprobe did not help here ]

Note: The case also applies for situations where you have the underlying partition has been changed ( using fdisk ).

Following are the steps taken to make the kernel recognize the new partition structure and to extend the filesystem

First we verified the disk sizes and allocations

# pvs
# vgs
# lvdisplay -m /dev/vg_name/lv_name  [ to get the underlying block devices ]
Now we had the partition table re-read for the underlying block device.

blockdev --rereadpt /dev/sdb
OR# sfdisk –R /dev/sdb

Do note that if you are doing this on a physical machine where we have multipath involved, we would need to re-read the partition tables for all the underlying disks involved.

Now that we have the partition table re-read, we would need to make PV resized to the new disk. Else it would still show the old size.

pvresize /dev/sdb

Check pvs / vgs output to see whether the new size is detected:

# pvs
# vgs

Once you have the new size detected, you can use the standard procedure to extend the filesystems

# lvextend -L +300G /dev/vg/lv
# resize2fs /dev/vg/lv

Check whether the new file systems are showing the correct sizes:

# df -h

Following are the screenshots of the entire activity which I performed in a test VM. A test VG and LV were created for this activity.

Verify current disk size of the mounted volume :

Check and verify on the available disk space on the underlying disk(s)

Increased the size of the vmware disk than adding a new disk in the virtual machine settings in vCenter.


Make the new sizes/partition visible on the system without reboot or taking the volume offline:

Extend the LV:

Resize FS: