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:
- Power up the virtual machine.
- Clean up the drive (empty the Recycle Bin, get rid of temporary files, and so on).
- You may even want to defrag the drive.
- Then, locate a file named virtual disk precompactor.iso (it should be in c:program filesmicrosoft virtual pcvirtual 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.
- Then shut down the virtual machine.
- 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!