Since I have two blogs and I write a lot about free software, I learned that if I wanted a main working computer, I needed to install and test all this software somewhere else! Reformatting every few months was just not an option anymore.
That’s when I decided to learn how to create a Virtual PC and install as much crap as I wanted! I have previously written about how to install a virtual PC using software like Sun openxVM and VirtualBox, but in the post I will be talking specifically about Virtual PC.
Setting up my environment in this way has been and saved me a load of time! However, one issue I ran into immediately was the size of the VHD file that Virtual PC creates. It just kept getting bigger and bigger exponentially!
Luckily, there is a way you can compact a Virtual PC disk using the program itself, but you have to do it properly in order for it to actually save any space. I didn’t realize this at first and was compacting away and ended up with the same size or even bigger VHD files!
Here are the steps you need to follow to properly compact a Virtual PC disk:
Step 1: First, you need to install Virtual Disk Precompactor. This program will prepare your Virtual PC disk for compaction.
Start up your Virtual PC, click on CD from the top menu, and choose Capture ISO Image.
Step 2: Now you need to browse to the Virtual Machine Additions folder in this directory:
C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions
Choose Virtual Disk Precompactor and click Open.
Step 3: The ISO image will autorun and when prompted to prepare the virtual hard disk for compaction, choose Yes.
Depending on the size of your virtual hard disk, it could take a while for the preparation to complete. Once it is finished, you want to click on CD and release the ISO image.
Step 4: Now close the Virtual PC by turning it off or putting it into a saved state. Once you have done this, click on File and choose Virtual Disk Wizard from the main Virtual PC window.
Step 5: Click Next and choose “Edit an existing virtual disk”. Choose the VHD file and then choose the open to Compact It.
Step 6: You can now choose to either replace the original file or to create a new file. If you want to be on the safe side in case something goes wrong in the middle of the compaction, you can choose Saving the file as.
Click Finish and the compaction process will start. You will hopefully see that this method will significantly reduce the size of your VHD file. Enjoy!







I just want to say thanks for sharing, it did resolve my problem with the VHD file.