As you use your virtual machine, it will continue to grow in size. I have my virtual XP machine to maximum of 10GB. All I really need it for is testing sites in IE6 (ick) and connecting to a SQL Server (ew). After installing a few things, running all Windows Updates… my vanilla XP is using 8GB. Wha? All I have installed is WinAmp, Cisco VNC Client, and SQL Manager. Whats going on?
“Well, when Windows deletes a file, it doesn’t actually
delete the data in the disk; it just deletes the references/pointers in
the file allocation table. So when ESX is exporting a VMDK and is
looking at the raw disk, it’s seeing values that aren’t empty
(non-zero), and exports them as such. The result is more disk space is
used and takes longer to export the disk.”
What we want to do is remove all unneccesary files. Caches, installer temps, restore points, and useless software. Then use VMware’s Shrink utility to reclaim the disk space. Other virtualization vendors will have similar solutions which may
vary. But the build up to the final ’shrink’ is the same. All steps are
carried out in the guest Windows XP virtual machine.
Results and Benefits
- Smaller guest OS footprint (mine went from 8GB to 3GB)
- Smaller virtual disk on the host
- When zipped, the virtual disc is smaller again (mine is 1.4GB) – making it much more portable
- With a cleaner guest OS, it runs much faster
- Suspend/Resume is close to instant
Turn Off Unnecessary Windows XP Services
First I turned off all Windows XP Services I did not need. You’ll have to deceide what you do and don’t want. You can do so from Services in Administrative Tools. Double click services you don’t want needlessly eating resources, Stop the service, then set the Startup Type to ‘Manual’ or ‘Disable’. Apply. OK. Do that to all services you don’t want running, then reboot the machine. Not sure what to disable? Jason A. Nunnelley has a good writeup: Turn Off Unnecessary Windows XP Services.
Uninstall Unused Windows Components
Next I deleted all Windows Components I’d not need. You’ll have to deceide what you do and don’t want. You can do so from Add/Remove Windows Components button of the Add/Remove Programs control panel. Double click each item, continuosly, to turn off anything you don’t want. Like extra Mouse Pointers, or Paint.exe. If using the typical Microsoft 85 pixel high scrolling window isn’t your thing, try using XPLite instead. It’s a nice GUI with even more options.
Turn off system restore
- Right click My Computer; select properties
- Click the System Restore tab
- Click the “Turn off System Restore” checkbox
Set Visual Effects to minimum
- Right click My Computer; select Properties
- Click the Advanced tab
- Click the Performance Settings button
- Click the “Adjust for best performance” checkbox
Clean the XP Drive
This will get all your bits in order. Run a defragmentation on your XP drive. This usility is located in: Start/Programs/Accessories/System Tools/Disk Cleanup
You can decide what to clean and keep. I deleted everything. This takes a little while.
Defragment the XP Drive
This will get all your bits in order. Run a defragmentation on your XP drive. This usility is located in: Start/Programs/Accessories/System Tools/Disk Defragmenter
It may take a while. Whisper words of wisdom, let it be.
Finally… the magic
Here is where the instructions branch, depending on whether you use Paralles, VPC, or VMWare. I have VMware, so these are the instructions for it…
Double click the VMware Tools icon in the Sytem Tray.
Click the Shrink tab. Tick the checkbox for your drive. Then click ‘Prepare to Shrink’. This will take a long time, longer if you cleaned a lot of space above.
Eventually it will ask you is you want to shrink your disk(s) now. Ya think? Click Yes. This will also take a long time.
And that’s all folks. You should now have a very slim XP virtual machine. I noticed mine running much faster. And with zip compression, it is now much more portable, at only 1.3 GB.
Of course, I did not figure this out all by myself.