Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use VMWare Fusion on my Mac to run a virtual Windows 7 machine, and the Microsoft IE compatibility Windows XP virtual machines.

In VMWare Tools on the Windows guest OSes, there’s a “Shrink” option that lets you reduce the size of the sparse disk image used by the guest OS, to save hard drive space on your host OX.

I’ve recently created another virtual machine, this time running Snow Leopard Server. I was wondering if I could shrink the spare disk image used by this machine too, but I can’t find a VMWare Tools app on the Mac guest OS, even though VMWare Tools have been installed (as VMWare’s Shared Folders feature is working).

Is there any way to shrink the sparse disk image used by Mac OS X guest OSes in VMWare Fusion?

share|improve this question
1  
Unfortunately this no longer works in VMWare Fusion 4 as the vdiskmanager is no longer in this folder. Nobody seems to know where it now exists if at all. –  user128435 Apr 15 '12 at 17:02
    
@user128435: Thankfully, VMWare Fusion 4 has a GUI interface for this functionality. –  Paul D. Waite Nov 16 '12 at 9:28
add comment

4 Answers 4

up vote 4 down vote accepted

In VMware Fusion since version 4 you can go to VM preference -> General -> Clean Up Virtual Machine.

Additionally there is a chart where you can see, what size is expected after shrinking.

share|improve this answer
add comment

Aha — indeed you can, as per this thread on the VMWare discussion boards about this issue, assuming:

  1. The file is a sparse disk image, and not pre-allocated.
  2. The VM does not have snapshots.

In short:

Erase free space on the guest OS’s disk from within the guest OS using Disk Utility, then shrink the guest OS’s disk from the host OS using vmware-vdiskmanager at the command line.

In long:

In the guest OS:

  1. Open Disk Utility.
  2. Select the guest OS’s partition.
  3. Go to the “Erase” tab.
  4. Click on the “Erase Free Space” button.
  5. Make sure “Zero Out Deleted Files” is selected, and erase the free space.
  6. Once it’s finished, close Disk Utility, and shut down the guest OS.

Or in the terminal of the guest OS when the partition is named 'Macintosh HD':

diskutil secureErase freespace 0 Macintosh\ HD
sudo halt

In the host OS:

  1. Open Terminal and type:

    [ -d "/Library/Application Support/VMware\ Fusion" ] && alias vmware-vdiskmanager="/Library/Application Support/VMware Fusion/vmware-vdiskmanager" || alias vmware-vdiskmanager="/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager"; vmware-diskmanager -k

  2. Type 'space' then the path to the virtual disk file of your VM.

  3. Hit return.

The guest OS’s virtual disk file is found within its virtual machine file. E.g. if your virtual machine file is at /Users/you/VM, the path to its virtual disk is /Users/you/VM.vmwarevm/VM.vmdk.

For the record, this shrunk a Snow Leopard VM of mine from 15 GB to 6 GB.

share|improve this answer
add comment

In variants of VMware Fusion, succeeding 3.x, the locale of vmware-vdiskmanager, as mentioned in the accepted answer is:

/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager

So all you need is

/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager -k 

then go to finder, navigate to your VM, which normally is in "~/Documents/Virtual Machines/".

Right click on the File, select "Show package contents", then drag the .vmdk-File to Terminal and hit enter.

share|improve this answer
add comment

In VMWare Fusion 6, it's a 3-step process.

  1. Replace any deleted files with zeroes:

    $ diskutil secureErase freespace 0 Macintosh\ HD

  2. Run VMWare's disk-shrinking utility

    $ sudo /Library/Application\ Support/VMWare\ Tools/vmware-tools-cli disk shrinkonly

  3. Shut down (or restart) the virtual machine.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.