Increasing VMWare Disk Sizes in Linux Without Rebooting

You can increase disk sizes in vmware guests whilst they are running. This is supported, but Linux will not see the new size of the disk until it reboots. There is a way around this (assuming here we are using LVM disks):

1. Increase the disk size in the vmware settings.
2. Logon as root onto the Linux guest system.
3. Do:

echo "1" > /sys/class/scsi_device/<device>/device/rescan

..where <device> is the SCSI bus you wish to rescan. This will take a while.

4. Increase the physical volume size by doing this:

pvresize -v /dev/<disk>

5. Check the volume group has an increased size:

vgs

6. If this is ok, you can then increase the appropriate logical volume(s) with the following command:

lvextend -L +<amount to extend by e.g. 10G> <lv name>

For a list of the logical volumes:

lvs

7. Finally you can extend the filesystem online:

resize2fs /the/filesystem

Note: If you have created partitions on the disk (which was a mistake!) you will need to use parted or fdisk to add an additional partition first, before then adding this partition to the volume group, using the vgextend command.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s