Reclaiming Free Space

I was tasked earlier in the week to reclaim free space from VMs that have been deleted or from snapshots that have been consolidated.

What I discovered was that from vSphere 5.0 to 5.5 had the ability but was disabled by default due to performance issues on the arrays during reclamation.  However, reclamation can still be done manually by issuing the following command

esxcli storage vmfs unmap -l <datastore name>

What is happening here is that when a VM is either deleted, moved due to SvMotion, or snapshots deleted/ consolidated, the VMFS datastore sees that space has been freed up, but not reported back to the array, and still holds on to that space.  So in the vCenter client, you’ll see the amount of free space available to you right away, but you’ll the LUN reporting a different number. I think this is normally not an issue as long as your datastores don’t fill up or if you’re running alerts against the datastores and not the array.

In any case the above command reclaims the space, but depending on how big the LUN is, it can take long time.

For example, to reclaim 50% of free space from a 8TB LUN took about 11 hours.

Good news, VMware had re-implemented the SCSI UNMAP commands in 6.5

Please keep in mind the scsi unmap command needs to be run from the host console.

%d bloggers like this: