slideshow 1 slideshow 2 slideshow 3 slideshow 4 slideshow 5 slideshow 6 slideshow 7

Shrink a VMware Workstation disk with VMware Tools command line utility in Windows

You can shrink a disk from inside a virtual machine running Windows with a command line utility named VMwareToolboxCmd.exe. The disk must not be a pre-allocated disk but should grow dynamically. 

Shrinking a disk can also be done from the Control Panel VMware tools entry, but when that is not available you can also do this from the command line. The utility is located in the folder C:\Program Files\VMware\VMware Tools.

Help for this command can be displayed with the command VMwareToolboxCmd help

You can first display available disks using the disk list option. As you can see in the screenshot below. Then start shrinking the disk with the disk shrink option. For example with this command
VMwareToolboxCmd disk shrink c:\

1

The shrink process starts with preparing the disk. As you can see in the screenshot above. The virtual machine is now still available but I strongly suggest to leave the VM alone during this process. Once the preparation is ready the VM will no longer be available and a progress bar will be displayed. See screenshot below. 

2 

During this process you can see that a temporary file is created where the data is written into. After the shrinking process the original disk is removed and the temporary file will become the new disk. In the screenshot below you can see that the original disk was 11.5 GB. The red arrow points to the temporary file that grows during the shrink process. Therefor you must also have some extra disk space available to hold this temporary file. 

TIP: This is one of the reasons that it is better to always split virtual disk files in 2GB parts because the temporary file during the shrink process will be created per 2GB part sequentially which means that less disk space is necessary during the shrink operation. Especially with large virtual disks this makes sense.

Once the process is finished the VM is returned to a normal state to work with. As you can see in the screenshot below the disk for the VM I was running is now 10.4 GB. 

4 

 

 

Follow us on LinkedIn