It is possible to free up quite a bit of hard disk space by compacting your virtual disks for VMWare.
Here is a easy (manual) way to shrink a Windows guest image hosted on VMWare Fusion for Mac OS. I have used the recipe below to successfully save about 50% of disk space for a Windows 2003 R2 guest image on Mac OS 10.5.2 running VMWare Fusion 1.1.1. Other Windows guest OS’s like Windows 95, 98, NT 4.0, Win2K, XP should work with this recipe as well, although this is untested at this time.
Warning: This recipe may/may not work for you. Beware of the risk! Remember to backup your disk image before messing with it. Finally, do not shrink a disk with snapshots as this is known NOT to work!! Update: See additional recipe at bottom of this post for how to deal with snapshots.
- First backup your guest os disk image and other files (just in case something goes wrong) + make sure you have plenty of spare disk space on your harddrive.
- Start Windows guest OS in VMWare Fusion and login as administrator
- Clean up & defrag guest OS disk image from within guest OS
* Delete all unused files, empty your trash can, delete your browser cache etc.
* Defragment your guest OS (f.x. using “defrag c:” in the cmd prompt).
- Zero out unused disk space in guest OS disk image
* Download Mark Russinovich’s disk erase tool SDelete v1.51+ and place it on the local guest drive (*1).
* From a command prompt navigate to where you saved the above delete tool and write “sdelete -c c:”, which will clear all free disk space
- Close guest OS and VMWare
* Shutdown your Windows guest OS.
* Quit VMWare fusion
- Shrink disk image using VMWare’s diskTool
* Navigate to the VMWare Fusion tools directory. E.g. type “cd /Applications/VMware Fusion.app/Contents/MacOS”
* Run VMWare Fusion’s diskTool command with the shrink option “-k” to compact your virtual drive (*.vmdk). E.g. type “./diskTool -k 0 full-path-to-your-virtual-desk-image.vmdk”. (*2)
*1) Nb. this erase tool is not documented to be compatible with Windows 2003/XP, but it works just fine on on my Win2003 R2 (as far as I can tell).
*2) Do remember the “./” when running diskTool to avoid mis-executing the Mac OS disk tool with the same name instead.
UPDATE – QUICK SNAPSHOTS CONSOLIDATION TIP:
If your disk image has snapshots you need to consolidate those into one large disk before attempting the above recipe. You can create a single disk image by cloning (merging) your disks using VMWare’s diskCreate tool (located in same folder as diskTool). The procedure is:
- Again backup your stuff first in case things go wrong (and again make sure you have plenty of spare disk space).
- Create a new folder with the extesion .vmwarevm to hold the output files.
- Navigate to the VMWare Fusion tools directory. E.g. type “cd /Applications/VMware Fusion.app/Contents/MacOS”
- “./diskCreate -C path-to-latest-snapshort-vmdk-file.vmdk path-to-new-merged-disk-file.vmdk” (use output folder above for destination).
- Copy the .vmx , .vmdk and .vmxf files into the output folder. Use a texteditor to edit the .vmx (and .vmxf) files to reflect the new disk file name.
- Test that the new consolidated image works in VMWare fusion.
- You can now proceed to the recipe for shrinking your disk.