ESX/vSphere grow disk under Linux

If you are running VMware ESX/vSphere with a Linux VM that is running out of disk space it is usually a trivial task. Assuming you have a simple partition layout like this:

If you want to grow the root partition follow these instructions. If you are growing a block device that has no partitions (eg. /dev/sdb is an ext3 file system) then you do not need to do the fdisk step and you do not need to reboot – just rescan the device and grow the file system.


First, grow the disk in ESX/vSphere to the size you want. Once this has been done you need to tell the VM to rescan the SCSI bus so that it is aware the disk has changed size. You need to know the device ID, if you have the lsscsi package installed, run that:

In this case /dev/sda has the ID 2:0:0:0. Send the rescan command:

The root partition can be resized now. If this is a block device with no partitions you can skip this step.

Using fdisk, note down the current layout then delete and recreate the root partition (you may or may not see the Partition 1 does not end on cylinder boundary error, ignore it):

You MUST ensure that the start value is the same before and after otherwise your system will not boot in most cases. Reboot the system so that the partition table is reread. Once the system has rebooted you can then resize your filesystem. Use the appropriate tool for your file system to do this, for ext3 this is resize2fs:

The file system has now been extended for your vm.

Posted in Linux and tagged , , , , , , .

2 Comments

  1. Warning: I have used this technique successfully with vSphere 5.0, but with vSphere 5.5 this was bad and a 2nd try at fdisk the volume was corrupted. I did better with a vSphere resize with VM off, and resizing via gparted-liveCD.

  2. For a safer approach, note that fdisk recommends to change the accounting usints from legacy default for msdos mbr (cylinders) into exact sector counts. Just press ‘u’ at the start of fdisk procedure (before ‘p’rinting the old state), and you are safely underway to recreate the expanded partition starting from the exact same location.
    HTH, Jim Klimov

Leave a Reply

Your email address will not be published.