Tonight on my ESXi host I noticed that I accidentally created a virtual machine with a thick-provisioned disk of 127 GB which was only using 13 GB, so I wanted to free up the 114 GB for other VMs.

The following instructions were extremely useful in resolving this problem:

  1. Turn off the VM which contains the thick-provisioned drive.
  2. Log into ESXi (I used an ssh connection).
  3. Convert the thick .vmdk file into a thin one:
    vmkfstools -i SERVERNAME.vmdk -d thin thinSERVERNAME.vmdk
  4. Rename the original .vmdk flat file:
    mv SERVERNAME-flat.vmdk orig-SERVERNAME-flat.vmdk
  5. Rename the new thin-provisioned flat file to replace the old one:
    mv thinSERVERNAME-flat.vmdk SERVERNAME-flat.vmdk
  6. Unregister the VM, and re-register it so that it picks up the new .vmdk file.
  7. Start up the VM to make sure all drives are available.
  8. Delete the original .vmdk files to free up space.
    rm thinSERVERNAME.vmdk
    rm orig-SERVERNAME-flat.vmdk

This is based on a post I found on the VMware community site, modified for my own use. Thanks to mabedfo for the content.

Leave a Reply

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