How to shrink VMware Fusion disk images?

I'm running Lion as a guest on a Lion host. I need to shrink VMDK disk images after handling large files on the guest.

Currently I'm using Disk Utility to clean empty space in the guest OS, then use VMware settings to convert the image from a single monolithic file to a 2GB split image (or the other way around). This just removed ~20GB from a disk image. Is there a saner way to do this?

Googling this yields only outdated results and their support site doesn't really help either. They tell you how to do it with VMware Tools on the guest system but only for Windows or Linux, not OS X.

Posted Dec 29, 2011, 4:29 PM UTC

23
phillymjs•

Make a backup copy of your VM first to be safe, and then try the Linux method. It mentions using vmware-diskmanager, which on the Mac exists at /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager.

Worth a shot.

1
third-eyeOP•

Thanks, I was looking for the new location of the disk manager, it was in a different place on earlier versions.

But I'd still need to find a way to zero out deleted files/space in the guest. On Windows there's an option for this in VMware Tools, I wonder why they omitted that on the Mac version.

1
phillymjs•

But I'd still need to find a way to zero out deleted files/space in the guest.

Same page linked above:

[On the host VM] run

cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

to fill the unused space with zeros.

No idea if that will work as-is in OS X, but even if it does, Disk Utility's "Erase Free Space" function within your VM should achieve the same results.

1