How to resize VHD file

Ever run into a situation that a virtual disk drive proved to small after a period of use? You can always add extra new virtual disk drives to provide extra storage for your virtual computer, but what if you require extra free space in one particular drive?

On the other hand, you can favour fixed size VHD files, and later discover you overdimensioned the virtual disk drive. How to make the fixed size VHD file smaller without converting it to the dynamically expanding type?

VHDMount utility and Symantec Ghost saves the day one more time. Here’s the procedure:

  1. Create a new VHD file of new required size.
  2. Mount the old and the new VHD files using VHDMount utility (distributed as a part of Microsoft Virtual Server 2005 R2 SP1):

    vhdmount /p /f old.vhd
    vhdmount /p /f new.vhd

    Note: Mounting the VHD files is possible only if the VHD files are not currently in use by any virtual machine or other program.
    You should receive a “The Virtual Hard Disk is successfully plugged in as a virtual disk device.” response, followed by a series of “New hardware found” messages.

  3. Run GHOST32 utility, which can be found in the directory where you’ve installed Symantec Ghost. Using the GHOST32 utility, you can “resize while copy” any of the local drives (LocalDiskTo Disk) including virtual ones now mounted. Make sure you choose the destination disk drive that represents the new VHD file, as you can easily overwrite any other local disk drive. Use GDISK32 utility to determine first which one is the new drive if uncertain.
    Once transfer is complete you can safely choose not to restart the computer and just exit the GHOST32.
  4. Unmout the VHD files:

    vhdmount /u old.vhd
    vhdmount /u new.vhd

One thought on “How to resize VHD file”

Leave a Reply

Your email address will not be published. Required fields are marked *