Shrinking VMware Virtual Disks
The guest cannot have snapshots and it cannot be marked as a template from which clones are made.
In VMware Workstation:
- For Windows guests:
- Start the guest system and log in
- Open a command prompt window in administrator mode
- C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe disk list
- C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe disk shrink C:\
- For Linux guests:
- Start the guest system and login as root
- Open a terminal window
- vmware-toolbox-cmd disk list
- vmware-tool-box-cmd disk shrink /
In ESXi:
- For Linux guests:
- Start the guest system and login as root through the vSphere Client console window
- dd if=/dev/zero of=/zero.bin bs=16M
- sync
- rm /zero.bin
- Shutdown the guest system
- SSH to the ESXi server
- Locate and change to directory that contains the guest's VMDK file
- vmkfstools --punchzero <guest>.vmdk