I’ve been running Virtual Server 2005 R2 for a few months now stress testing it on a machine seeing where the limits were before real deployment. Machine is a P4 dual core with 4G of ram. It has 1 Windows 2003 server host and 6-8 XP hosts running at any one time. The main bottle neck seems to always be the harddisk. It just can’t keep up with things. When things are running the disk queue is a solid line across the top of perfmon. Before you say it, the VM’s aren’t running lots of disk actions and in fact if I reduced the number of VM’s and increased the ram, it’d probably drop the disk usage way down.
Anyway when setting up these VM’s for testing, differencing disks seemed to be the way to go. New VM’s took a matter of minutes to setup and getting running. Now that they are running for nearly three months, it is looking not so hot. Each VM has about 4G of space used inside their virtual disks but yet the master disk is around the 3G mark with the differencing disks being over 6G. Something really wasn’t adding up. Clearly a disk file should take up more space than the data on the disk.
Merging the differencing disk
First thing I tried was to merge the differencing disk. To do this, you inspect the disk, then under actions, merge the disk and choose a new file.
Compacting the disk
Once the disk was merged, it gave the option to compact the disk. Running this did nothing but waste time making the new disk no smaller than the original.`
The Solution
So after some googling and trial and error, the following steps seem to have worked and made the disks a lot smaller.
- Merge the differencing disk into a new disk.
- Mount the new disk to the VM.
- Boot the VM and defrag the disk using Windows Defrag.
- Mount the precompator vm tool in the VM. This tool is found in precompact.iso in the Virtual Machine Additions folder in your Virtual Server install directory. (Usually C:\Program Files\Microsoft Virtual Server\Virtual Machine Additions\Precompact.iso)
- Run the precompactor in the VM. (This does take a while to run)
- Shutdown the VM and compact the hard disk image as above.
All in all, I got near a 50% reduction in real space usage which brought it closer to what the VM’s are actually using.