How to reduce the size of your VMs (macOS Update)

20th March 2017

​
Lately I'm also running macOS virtualized for testing various apps. After some heavy usage the same problem popped up: the .vmdk uses way too much space on my quite small 256GB SSD. Currently is at around 70GB.

The process is similar to what I did on Windows and Linux i.e. write a null file that is erased at the end then use the command-line tools to compact the .vmdk and reclaim space (the example is specific for VMWare Fusion).

Without further ado:

Step one

Fill up all the empty space with 0x00

$ cat /dev/zero > zeroed_empy_space; rm zeroed_empy_space

In case you're wondering what /dev/zero does:

/dev/zero is a special file in Unix-like operating systems that provides as many null characters (ASCII NUL, 0x00) as are read from it. One of the typical uses is to provide a character stream for initializing data storage.

Step two

VMWare Fusion is installed by default in /Applications/VMware Fusion.app so you just have to run: