VMplayer Virtual Disk Shrinking/Compacting/Defragmenting

Solution 1:

First, please realize you don't have to do this maintenance very frequently. If you want to go through the full list, here's the order and rationale.

  1. Defragment within the VM (if the machine is thin-provisioned, defragmenting later will expand the .vmdk as blocks are moved)
  2. Shrink the disks within the VM (this writes zeroes to unused sectors so the host can recognize which blocks are unused). This will temporarily increase the VMDK size to the configured size of the virtual disk. Then power off the VM.
  3. Defragment the disks from within VMware Player. This will move the blocks in the VMDK from their chaotic state (due to growth/use) and order them by actual block number.
  4. Compact the disks from within VMware Player. Since the empty blocks are zeroed, VMware can remove those blocks from the VMDK and reclaim space on the host.
  5. Defragment the host system to reorder all host files (including the VMDK) and remove fragments.

Solution 2:

On newer versions of VMWare Player, this should work:

VMTools ui don't exist so do the shrink in an (elevated) cmd prompt:

cd "C:\Program Files\VMWare\VMTools"
VMwareToolboxCmd.exe disk shrink c:\