How to shrink a Mac OS X Lion guest in VMWare

  1. In the guest: Use Disk Utility to Erase Free Space: Start the Disk Utility.app, select the disk in question, choose the Erase tab and click the Erase Free Space button there. The Shell one liner cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill will do as well probably.
  2. Shutdown the guest.
  3. Defragment the virtual disk by using vmware-vdiskmanager -d /path/to/your-lion.vmdk.
  4. Finally shrink the virtual disk by using vmware-vdiskmanager -k /path/to/your-lion.vmdk.

Notes

  • Don't forget to backup your virtual disk before doing the steps above.
  • vmware-vdiskmanager on the Mac is located at /Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager (VMWare Fusion 4.0).

Comments

Defragging unnecessary

Step 3 defragging the virtual disk probably needs to be done before Step 1 zeroing out unused disk space. Otherwise, the disk space that used to be occupied by fragmented files before they were moved will be dirty and non-zero. But defragging in OS X is usually considered to be unnecessary, so it should be skipped entirely instead.