VMware Workstation - How to Shrink a Mac OS X .vmdk (Virtual Mounted Disk) File How to effectively reduce the file size of a Mac OS X .vmdk file in VMware Workstation 12+

VMware Workstation - How to Shrink a Mac OS X .vmdk (Virtual Mounted Disk) File

As most people probably notice, the .vmdk files created by VMware for Mac OS X Operating Systems tend to continuously grow as time passes by, getting bigger and bigger after each update.

Luckily enough, there's an easy fix that can be manually performed to reduce the vmdk file size. Here's how you can pull it off in two steps, the first one within the guest OS (the Mac OS X) and the latter on the hosting PC environment.

  • Launch your guest OS X Virtual Machine.
  • Open the Finder app and retrieve the actual name of the HDD you need to shrink (for example, "Macintosh").
  • Open Terminal > Shell and issue the following command:
    • sudo diskutil secureErase freespace 0 Macintosh 
      • use su  instead of sudo  for Mac OS X 10.9 or lower.
      • if you receive a "Macintosh HD not found" error, open the Finder app again and be sure that the HDD name matches the one you wrote.
  • Wait for the command to terminate its task: be warned that it will probably require some time (10+ minutes or more), depending on the current vmdk disk size and the performance of the hosting machine's storage unit. It's worth noting that when it comes around 90 percent a VMware error popup could possibly appear, which you can safely ignore (by hitting the Continue button) as long as it will continue the task up to completion.
  • Once done, shutdown the Mac OS X VM - be sure to do that!
  • On your main/hosting PC, open a Command Prompt (or Terminal > Shell) with elevated priviledges and type the following command:
    • \VMware-Path\vmware-vdiskmanager.exe -k \VM-Path\VM-name.vmdk
      • (replace VMware-path with the path of VMware installation folder and VM-path with the path of the .vmdk file to shrink).

The last operation can take some time (30+ minutes), but as soon as it's done your .vmdk file will be shrinked down to its real and correct size, possibly saving up GBs of space!

Here are some screenshots showing the whole process: the first command on the Guest OS (Mac OS X Sierra):

VMware Workstation - How to Shrink a Mac OS X .vmdk (Virtual Mounted Disk) File

The 90% VMware error message that you can safely ignore by hitting Continue:

VMware Workstation - How to Shrink a Mac OS X .vmdk (Virtual Mounted Disk) File

And the command to be issued within the Hosting OS (Windows 10):

VMware Workstation - How to Shrink a Mac OS X .vmdk (Virtual Mounted Disk) File

That's it! I sincerely hope that this procedure will help those who are struggling with this nasty issue, until VMware will implement the option to automatically perform such task.

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.