Resize a Microsoft Virtual Hard Disk (VHD) File - Step by Step

An article from Pieter's Knowledge Base


All information on this page is provided on an as-is basis with no warranty of any kind. Using this information is at your own risk. In no case I will be held liable for any damages resolving from using this page.

My recommendation: always makes sure you have valid backups of your original files before working on your virtual machines or disks!

Resizing A Virtual Disk

Once you have created a virtual disk (and possibly installed an operating system on it), its maximum size is fixed, even if it is a dynamically expanding disk. So if the virtual disk has a maximum size of 10 GB, it will never grow beyond that size, and Virtual PC itself is not capable of resizing. There is, however, a way around it, which we will go through step by step.

Note: this procedure only works with virtual machines running Windows 2000, Windows XP,Windows Server 2003 and Windows Vista. For Windows 7 and 2008 R2, the procedure is slightly easier, as these versions of Windows support VHD files natively. Please see this paragraph for more info.

Before starting to work on VHD files, make sure the virtual machine they are part of has been properly shut down, i.e. it should not be in a SAVE or SUSPENDED state!

The first step to perform, is to resize the virtual disk using a free tool named VHD resizer. You can download it from:

  • After installing it, start it from the start menu: Start / All Programs / vmToolkit / Vhd Resizer
  • First, you will be asked to provide the file name of the virtual disk to be resized:
  • Next, provide a name for the resized vhd file (Vhd Resizer will create a new file, not replace the existing one, which is convenient, since we will need the original one later):
  • In the above dialog, also specify the type of virtual disk (dynamically expanding or fixed size) and a maximum size.
  • Next, click the resize button to start the resizing process. Once completed, you will be notified by a message box.

Expanding the partition on the Virtual Disk

After you have resized the disk with Vhd Resizer, the partition (drive) on it will still be the same old maximum size, and not grow when it needs to! So we need to resize the partition as well.

As is clear from the example above, we now have two virtual drives:, the old one and the new one. It is convenient that we still have the old one, since we can use it to work on the new one. We are going to demonstrate this using Microsoft Virtual PC, I trust you know how to accomplish something similar with other Microsoft virtualization products. Also, for Windows 7 and Windows Server 2008 R2, please check the paragraph Expanding the partition in Windows 7 and Windows Server 2008 R2.

  • Start the Virtual PC Console, select the virtual machine for which we want to resize the virtual disk, and click the settings button:
  • Select an unoccupied hard disk, e.g. Hard Disk 2 as indicated in the window above.
  • Click the Virtual Hard Disk File radio button, followed by the Browse button to select the new virtual disk file:
  • We now have a virtual machine that boots from the old virtual disk, but also provides access to the new virtual disk. Click the OK button to close the Settings window.
  • Start the Virtual Machine.
  • In the virtual machine, start Computer Management (either by right-clicking the My Computer icon and selecting Manage, or by selecting the Computer Management icon in the Administrative tools menu, if you have that one enabled).
  • In Computer Management, click the Disk Management icon. You should see two hard drives, one with unallocated space available:
  • In the example above we have two drives:
    • Disk 0, which is the system we booted from and shouldn't make changes to!!
    • Disk 1, which is the drive we need to resize. Write down the name of this drive (in this example: "Disk 1")
  • Close Computer Management.
  • Start a command line prompt by clicking Start / Run, and typing CMD and pressing the Enter key:
  • We now have a command window. Type "diskpart"and press the Enter key:
  • At the DISPART prompt, type "List disk" (+Enter) to list all available drives. We should see the same drive names we saw in Computer Management:
  • In our example, we need to work on Disk 1, so we make it the active disk by typing Select Disk 1 (+Enter):
  • Now we need to find out what partitions are on this disk. Type Detail Disk (+Enter):
  • The listing shows us this disk has one volume named Volume 2. We need to select it, so we type Select Volume 2 (+Enter):
  • Finally we proceed to increasing the size by typing Extend (+Enter). The volume will now be resized to the maximum available size:
  • We can now exit Diskpart by typing Exit (+Enter) and the command window as well by typing Exit (+Enter) once more.
  • Verify that the partition has indeed increased with Disk Management:
  • You can now shut down the virtual machine, change the settings so that the new virtual disk is the disk the machine is booted from. Enjoy your new virtual disk size!

Expanding the partition in Windows 7 and Windows Server 2008 R2

Expanding the partition is slightly easier with these new versions of Windows, as they support access to VHD files natively, as if they were regular disks! Instead of attaching the newly created virtual disk in a virtual machine and then booting it (as explained above), simply attach the new VHD file in Disk Management by choosing ACTION / ATTACH VHD from the menu and continue to extend the partition using the DISKPART utility.

This video demonstrate how to:

Useful? Please donate!

Was this article useful to you? Please consider making a donation through PayPal. I'm glad with any amount you wish to contribute, it helps me to pay the bills!

Disclaimer: All information on this page is provided on an as-is basis with no warranty of any kind. Using this information is at your own risk.

© 2007-2011 Dutch Alps/Pieter Mol