Shrinking a VMWare virtual machine
First of all, what does shrinking a virtual machine mean? It means to reduze the size of the virtual machine on the disk of the host system.
It's often the case that the virtual disk inside the guest operating system has plenty of free space. But it is the nature of virtual machines that they don't give back disk space to the host.
How to shrink a virtual machine
Granted you run Windows as your host and Linux as your guest, here's a list of instructions on how to accomplish this task.
- First, make sure to install VMWare Tools in the guest operating system.
- My research revealed that there's a project called open-vm-tools. According to this VMWare announcement, open-vm-tools obviously replaced the closed source tools originally published by VMWare.
- Follow these instructions to install open-vm-tools in your guest. In short, what you basically do is to
apt-get install open-vm-tools
, mount the installation files somwhere and execute the Perl installation script. - Now you're able to call the
vmware-toolbox-cmd
in a shell. - The exact command that helped me wipe (fill unused space on guest space with zeros) and shrink (reduze size of vmdk files on host) was
vmware-toolbox-cmd disk shrink /
-
Where's documentation on VMWare tools / open-vm-tools?
To put it in a polite way: finding documentation was frustrating. The closest to a documenation I could get was this PDF from VMWare. Another hint was this VMware Knowledge Base article. This forum post in VMware Communities also sheds some light on that topic.