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.
- Defragment within the VM (if the machine is thin-provisioned, defragmenting later will expand the .vmdk as blocks are moved)
- 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.
- 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.
- 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.
- 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:\