Blog

Blog posts made on 25-Dec-07
25Dec
2007
How To Shrink A Virtual PC Virtual Hard Disk

Microsoft Virtual PC uses virtual machine hard drive images as disks. These VHD files are typically dynamic in size, they grow as necessary. And I had one grow on me yesterday to over 40GB in size! Microsoft provides a Virtual Disk Wizard which can be used to compact virtual disks (when the virtual machine is not running). But, running it barely reduced the size at all. The problem? The wizard looks for space that has been zeroed out, so that must be done before running the wizard. It would have been nice if the wizard had spelled this out, and also provided instructions on how to do this. But it doesn't (which is odd, as Microsoft actually provides a mechanism to do this)! So, in case anyone else runs into this one, this is what you need to do:

  1. Power up the virtual machine.
  2. Clean up the drive (empty the Recycle Bin, get rid of temporary files, and so on).
  3. You may even want to defrag the drive.
  4. Then, locate a file named virtual disk precompactor.iso (it should be in c:\program files\microsoft virtual pc\virtual machine additions), and capture the ISO image (right-click on the CCD icon to do this). This will start the precompactor program which zeros out unused space.
  5. Then shut down the virtual machine.
  6. And finally, run the Virtual Disk Wizard which should shrink the virtual disk, removing all zeroed out space.
My virtual disk is now down to a more manageable 6GB, whew!

Read More ›