I guess not me the only one, who have already had problem due to the size of a vhd file. After you created a new machine under Microsoft Virtual PC, and you want to add a new virtual disk to the config, you can select four different options:
I always choose the “Dynamically expanding” one, because in my opinion this is the most convenient. In this case I won’t face with the size problem, and my vhd can dynamically grow. And what if I would like to reduce the size, because I successfully free up some space inside my VM?
In the picture above, under the first option you can read important information. “The disk size does not compact automatically when data is deleted. To compact the disk size, edit the disk using this wizard”. Okay, it sounds easy, let’s use the disk wizard. But before you do that, I tell you nothing will happen. The disk size remain the same after the compression. An important information is missing. First of all you need to use a tool which will zero out the free space on the disk.
In the Microsoft Virtual PC install folder, under the Virtual Machine Additions you can find an iso file with the following name: “Virtual Disk Precompactor”. Such a voluble file name. So capture it! The iso is by default auto-run enabled so after mount you should see the following message:
Click yes, and the process begin.
If the pre-compaction is successfully finished, a message appears. Right after that turn off the virtual machine. Now the vhd file is ready for compress. Go to the disk wizard. Browse your file and edit it. At the end you have two choices. You can see them in the picture below.
I hope I could help.