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 zero
This 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.vmdk
The 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/)
This worked perfectly for me (Fusion 3.1.3 and Fedora 14). I am very grateful for this procedure!
ReplyDeleteI would just add 'delete any snapshots available' as an additional step before step 3, since this is a requirement for the 'vmware-vdiskmanager' defragment command to work.
ReplyDeleteOn my version of VMWare Fusion (4.1.1), the 'vmware-vdiskmanager' program is inside /Applications/VMware Fusion.app/Contents/Library (instead of /Library/Application Support/VMWare Fusion).
ReplyDeleteThanks for the comments - added to post.
ReplyDeleteFinally! Worked great thanks!
ReplyDelete