Expand virtual machine boot volumes with no downtime

One of the great things about using virtual machines is how easy it is to quickly modify their hardware configuration.  One common change that administrators often make is to expand the size of the virtual machine’s hard disk.

Windows data volumes are easy to expand by simply growing the disk file and then using Microsoft’s Diskpart utility to make the extra space visible in the guest.  This can be done on the fly with no downtime to the virtual machine.

For boot volumes it is more complicated and is typically handled in one of two ways. First, the admin expands the boot drive of the virtual machine to the desired size. Then the VM is shut down, and one of the following two methods is used to expand the volume:

    1. The expanded hard disk is attached to a second virtual machine, and then Diskpart is used to make the new space usable in the guest.  That second VM then has to be shut down, the disk removed from the configuration, and both servers booted back up.

    1. The VM is booted with a GParted ISO which allows the volume to be expanded.  Windows will force a chkdsk run at next bootup but will then see the expanded size.

While these are acceptable solutions, both require downtime of one or more virtual machines.  To get around the downtime requirement, you can use a utility called ExtPart from Dell. It is used to expand partitions on Dell storage arrays but works just as well in a virtual machine. Note that it can only be used on Basic disks in Windows and does not work with Dynamic disks.

The following example shows expanding a 17GB C: drive to 20GB on a Windows 2003 VM with no downtime required.  Note that this process is not required on Windows Server 2008 since the ability to grow volumes is now a feature of Disk Management.  Simply right-click the volume you wish to expand and select Extend Volume.

1) Edit the virtual machine settings and increase the boot volume to the desired size.

 

NewHDSize

2) Launch Disk Management and select “Rescan disks” to detect the new space.

RescanDisks

3) Run ExtPart with the following syntax: extpart.exe <volume> <AdditionalSizeInMegabytes>

extpart

After completing steps 1-3, the new space should be recognized in Windows automatically.

HDAfter