Friday, July 01, 2011

Reclaiming thin-provisioned disk space in VMware

My coworker copied a bunch of VMDK files to a VM so he could import them into VMware. This process worked fine, but left his VM disks using almost their full capacity, even after the files were deleted. When attempting to SVMotion the VM (and re-thin the disks), it failed because there wasnt enough room at the destination disk - for some reason VMware was not re-thinning the disks properly.

A little googling came up with a post at http://www.virtualizationteam.com/virtualization-vmware/vsphere-virtualization-vmware/vmware-esx-4-reclaiming-thin-provisioned-disk-unused-space.html. This talks about using a tool called SDELETE (http://technet.microsoft.com/en-us/sysinternals/bb897443) to zero out the unused blocks on the disk. Once zero'd, the SVMotion should thin the disks properly.

Steps to reclaim the disk space:
  1. Download SDelete from Microsoft
  2. Run sdelete -c e: (or the appropriate drive letter)
  3. Use SVMotion to move the disk to another datastore
 NOTE: This can take a long time depending on the disk, and will churn your back-end storage. Dont do this during production hours, or you may have customers complain about performance issues

No comments: