Resizing a VHD

by Mitch Tulloch [Published on 13 March 2008 / Last Updated on 13 March 2008]

How to expand a virtual hard drive.

Sometimes with Virtual Server you find out after awhile that the virtual hard drive (VHD) you created for a VM is too small. If this happens, here’s how you can expand your VHD to increase its size:

  1. Start by downloading VHDResizer from vmToolkit.com (http://vmtoolkit.com/files/default.aspx). Te tool is free but registration is required.
  2. Run the tool and specify the source VHD (the one you need to expand) and a destination VHD (which will contain your expanded VHD).
  3. Mount the destination VHD on your host machine using the vhdmount /m /f destination.vhd command.
  4. Use diskpart to extend the volume on your destination VHD so that it fills the drive. For example, type list disk to identify which is your new disk, then type select disk N to select that disk, then use list partition to identify the partition number on this disk, then use select partition N to select that partition, and then use extend to extend the partition to fill the disk. Leave diskpart.
  5. Unmount the VHD using the vhdmount /u destination.vhd command.

Note that since VHDResizer is not a supported tool from Microsoft, this method is technically unsupported, but readers I know have never had a problem doing it this way. Still, be sure to test this method first in a test environment before trying it on your production network. Presented “as is” with no warranties.

***

Mitch Tulloch was lead author for the Windows Vista Resource Kit from Microsoft Press, which is the book for IT pros who want to deploy, maintain and support Windows Vista in mid- and large-sized network environments. Mitch was also the author of Introducing Windows Server 2008 and technical project lead for the Microsoft Office Communications Server 2007 Resource Kit, both books also from Microsoft Press. For more information on these and other books by Mitch, see www.mtit.com.

Featured Links