Shrinking sparse hard disk images in VMware is easy. Sun’s VirtualBox requires a little bit more work.

  1. Power up the VM and defragment the disk.
  2. If you plan to compress the machine afterwards fill it’s hard disk with zerosĀ  (nullfile works quite well – you can download it from here)
  3. Power the VM down.
  4. Open a cmd on the host machine and change into the VirtualBox install directory
  5. Execute VBoxManage modifyvdi path_to_your_vdi_file compact

This will take a while!

Tags: , ,