Reclaim VMDK space on a Thin-Provisioned SAN

Sometimes what your VM shows and your Datastore shows are too different things.  When you have a lot of deletes within your VM you thin-provisioned SAN is unaware of this free space.  This is due to the inability of your thin-provisioned SAN to actually see inside the VMWare VMDK format. This can cause a lot of frustration for everyone.  Unfortunately, the process is a downtime procedure and depending on the size of you VM and Datastore it could take a while.


For windows you will need a product called SDELETE installed on your VM use version 1.61 or above. It can be obtained here:

Unzip it and open a command prompt with admin privileges. Next navigate to your SDELETE Folder. For example c:\files

And run sdelete.exe –z (drive letter)








This will zero out the free space on your drive and essentially mark it as recoverable.  This process make take a long time and also impacts performance. I would suggest not having much I/O go to the machine during this time.

For Linux you would simply run –

dd if=/dev/zero of=/[PATH]/zeroes bs=4096 && rm -f /[PATH]/zeroes

****Exclaimer doing sdelete or DD command will fill your VMs’ thin provisioned  HDD to its actual size, so make sure your datastore has the space.

Once that is completed you will need to shutdown the server

Open putty and putty into your ESXI Host-

Open the datastore that your VM is on

Cd /vmfs/volumes/datastorename

Then do an ls to make sure your VM name is there that you were working on

Then the name of your vm

Then you should do another ls command to see your VMDK files. Each will corispond with a drive on your VM. So if you have more than one you will see a VMNAME1_1.VMDK etc. You will need the drive that you ran the SDELETE on. You can find what VMDK it is in the Edit Settings of the VM in your HDD properties

Ok now you need to run vmkfstools –punchzero vmname.vmdk

You then run cd to go back to ~  and will run a command to unmap on the Storage side. (ESXi Version 5.5)

Esxcli storage vmfs unmap –l datstorename

You then can turn your vm back on. Your VM, datastore, and SAN should all be showing the correct same used space now!

No comments.

Leave a Reply