Shrinking a Linux VMDK disk under VMWare Player 7

Published by Tobias Hofmann on

1 min read

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.

Result

Execution

After the program finishes

Reduction of disk size

Size before:

Size after:

In total, this saved me 10 GB.

Let the world know
Categories: Technology

Tobias Hofmann

Doing stuff with SAP since 1998. Open, web, UX, cloud. I am not a Basis guy, but very knowledgeable about Basis stuff, as it's the foundation of everything I do (DevOps). Performance is king, and unit tests is something I actually do. Developing HTML5 apps when HTML5 wasn't around. HCP/SCP user since 2012, NetWeaver since 2002, ABAP since 1998.

1 Comment

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. […]

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.