If you use thin VMDK in your lab or dev environments then you probably know that over time these VMs can inflate to very large size. Say you deployed a windows server and gave the C:\ drive 80GB. Initially that VM was maybe using ~30GB. After some time you notice the VM is now 70GB but the OS still claims usage of ~30GB. This is due to the way data is written and deleted from a disk. The way to fix is to zero out the whitespace.
- Download sdelete from MS.
- Run the sdelete.exe utility against the C:\ using the -z parameter.
sdelete.exe -z C:
- Power off VM and ssh to ESXi host. Find the VMDK and run the following command.
vmkfstools --punchzero diskname.vmdk
Check size by typing:
du -h diskname-flat.vmdk
- Finally power on your VM.