Shrinking a Linux VMDK disk under VMWare Player 7
I wrote about this problem already earlier in 2015, but after installing VMWare Player 7 and a CentOS based VM, the process did not work anymore for me. I did the dd part to fill the disk with 0, but the Player tool for shrinking did just execute without doing nothing. Running from within the VM the vmware-toolbox command for shrinking a disk returned an error message.
Command: vmware-toolbox-cmd disk list
What happened? I do not know for sure, but it looks like VMWare Player does not like a lot CentOS and XFS for shrinking. For my VM the actual space used inside was reported by df –h as not even 15 GB, while on the physical disk it occupied 25 GB. So, how to get back several GB of space?
There is a tool available from VMware that allows to shrink a vmdk offline. It`s part of VDDK and of their Workstation and more professional products, but not for Player. With the use of Google I found a KBA article where the tool is actually attached. Downloading the tool and put it into the right VMPlayer directory so it can find some DLLs needed for execution. You can also download the VDDK SDK where the tool is included: Download VDDK. After installing the tool, call it with the –k flag to compress a vmdk disk.
Command: vmware-vdiskmanager.exe –k <path to vm>\<Name of disk>.vmdk
The name of the disk can be seen in the directory, it’s the one ending on vmdk.
After the program finishes
Reduction of disk size
In total, this saved me 10 GB.
Shrinking a VirtualBox VDI disk image | It`s full of stars! · March 12, 2020 at 14:01
[…] The space used in the VM is 33 GB, and the VDI file is 45 GB. I want to keep the file size minimal. Disk space has a precious value for MacBook users. How to clean up the disk? The steps are the same as shown in my previous blog on how to optimize a VMDK disk. […]