My little USB hard drive recently ran into a space constraint issue because of the footprint of my Virtual Machines I keep stored there. So I went about attempting to reclaim some space by collapsing my Virtual Machines expanding disks and freeing space that they were not using.
A note about my configuration:
I use Virtual PC (2007 Beta) as well as Virtual Server 2005 on Vista RC1. I use Virtual PC when I don't have the requirement of having 2 virtual machines running at the same time. When I have to simulate a domain scenario, etc. I then fire up the VPC's in Virtual Server. So far I've had pretty good luck using t hem interchangeably between VS and VPC.
An note about differencing disks:
I'm not Virtualization expert, however, I use differencing disks to save space whenever possible. The guidance I've found is that you can't collapse virtual machine differencing disks. You can only merge them back into their base image (thereby breaking a chain of dependencies that other machines will have on this vhd).
The guidance to reclaiming space from dynamically expanding (non-differencing) disks is as follows for VPC and VS 2005:
- Open the virtual machine and defragment the virtual machine's hard drive
- Mount an ISO within the virtual machine found in the utility directory of the VPC install called the Microsoft Virtual Disk Pre-Compactor found at C:\Program files\Microsoft Virtual PC\Virtual Machine Additions\Virtual Disk Precompactor.iso.
- Shut down the virtual machine. Here is where the paths differ between VPC and Virtual Server 2005
- In the Virtual PC Console, run the Virtual Disk Wizard and choose to edit an existing virtual disk and browse to the hard disk.
- Select compact it and replace the original file
- Virtual Server
- Choose to inspect the Virtual Hard disk and select the disk from the drop down
- Select the compact operation