Anyway I tried to run the vmware-tools which I installed (after a bit of jiggery-pokery) and it comes up with a 'Shrink' tab but no disks appear in the list to shrink?! Any suggestion as to how to get disks to show up there are welcome but I couldn't find much on the web about it...
So instead I looked about and the best way is to take the following steps:
- Start your VM OS up and optionally remove any cruft. At least run:
sudo apt-get autoclean
- To prepare for the shrinking process run:
sudo cat /dev/zero > zero;sync;sleep 1;sudo rm zeroThis fills all remaining space on your virtual disk with a file full of zeros so the space can be reclaimed in the shrinking step.
Note: Your hard disk WILL NOT fill up as the vmdk images do actually optimise the storage of files containing zeros
- Shutdown VM OS and delete any snapshots available then Quit VMWare Fusion
- To start the shrinking process in OSX run (Replacing path_to_your/disk with something like '/Users/username/Documents/Virtual Machines/Ubuntu/Ubuntu.vmdk'):
cd '/Applications/VMware Fusion.app/Contents/Library' ./vmware-vdiskmanager -d path_to_your/disc.vmdk ./vmware-vdiskmanager -k path_to_your/disc.vmdkThe first command defragments the disk, whilst the second actually does the shrinking.
(Note: The directory for 'cd' for 3.X of VMware Fusion was:
/Library/Application Support/VMware Fusion/)