vmware, website

How to Shrink a Thin VMDK on ESXi 5.x Offline

Over time virtual machine guests will grow in size if provisioned as a thin disk due to files being copied or log files being generated, once the files are unallocated (deleted or moved) the vmdk still reserves the location as used thus causing excessive white space. If you have a large datastore with a low cost per gigabyte then this isn’t so much of a problem but if you have a lot of virtual machines on a SSD which is still quite costly per gigabyte then you will want to reduce the size of them (like me).

I highly recommend doing a backup of the whole virtual machine to a separate datastore before preforming these steps. You can use a product called Veeam to do this, there is a free version with limited features but still works perfectly. You can find Veeam here

Firstly check what the allocated and actual size of the guest are:

  1. Log into shell or console of ESX physical host
  2. cd /vmdk/volumes/%disk%/%folder%
  • %disk% = the disk name
  • %folder% = the folder the vmdk file resides in
  1. ls –lh *.vmdk
  2. du –h *.vmdk


Note: This process will make the VMDK start expanding to it’s maximum size so make sure you have enough space on that datastore or any guests that reside on it will shutdown!

You can download SDelete by Sysinternals here

  1. Log into Windows server
  2. Download SDelete
  3. Run SDelete
  4. SDelete – %:      (% = Drive letter)SDelete
  5. Shutdown the VM guest, if you don’t you will not be able to get a lock on the vmdkPunchzero Failed Lock
  6. vmkfstools -K %vm.vmdk>Punchzero Pending
  7. du -h *.vmdk

Should you have any questions, comments or suggestions, please don’t hesitate to comment below. If you like what you have read, please share it on your favourite social media medium.

2 Responses to “How to Shrink a Thin VMDK on ESXi 5.x Offline”

  1. Milan Kinkal

    Hello Chris,

    We have ESXi 5.1. I did exctly the same proces. Unfortunatelly in the end of “punchzeroing”, the VMDK stays exactly the same size as before, no free space claimed back. Could anyone please assist me with this?

    Kind regards

    • cr_admin

      Hi Milan,

      You might actually be using the full amount claimed hence why it is not going down, if a VM is vmotioned then it zeros the disk also.
      I will use this exact process to zero a VM and let you know how I get on (I use ESX 5.1 Up2).

      I will get back to you soon,




Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.