If you are thin provisioning VMs in your environment with an Equallogic SAN attached to your cluster, you may find that you start receiving warning from SAN HQ or your group manager alerting which states [ID: 4.2] Caution: % In-use space on volume. Let’s look at ESXi 6 Equallogic reclaim free space.
When you look in your VMware environment at your datastores, you may see that you have plenty of free space available. What gives? After thin provisioning when you delete data from blocks on a volume in VMware, these blocks are marked as available for future use by vSphere however, on the Equallogic side, as far as it knows, the blocks are still assigned and not available for use.
I ran into this issue recently with a LUN that was the target of a script which backed up a few one off VMs using thin provisioning. After a while, the Equallogic volume started alerting that it was over the threshold of free space, however, within VMware the free space was fine.
Equallogic reclaim free space
Enter the unmap command in ESXi 6.0. Actually the command debuted in ESXi 5.5 and replaced the vmkfstools -y command which was deprecated at that point. The unmap command allows deleted blocks to be reclaimed on thin provisioned LUNs that support the VAAI UNMAP primitive. Using the command is fairly simple. You simply need to know the UUID of the datastore you want to reclaim space on.
esxcli storage vmfs unmap -u 11111111-2222222e-1b24-c12345678abcd
In the command above we are reclaiming free space of the volume “11111111-2222222e-1b24-c12345678abcd”. The volume UUID is easy to get – SSH into your host and navigate to your /vmfs/volumes and list the volumes from there. You will see the “datastore” name in front of the UUID the system understands. In putty you can simply drag over this and it will be copied which makes for an easy past into the esxcli storage command listed above.
In Equallogic reclaim free space, you can actually watch in group manager and see the space being reclaimed real time. The process takes a good bit of time and is not an “instant” process. Also, disk I/O on your Equallogic SAN will be impacted with a lot of Read activity as space is reclaimed so be prepared for a performance impact.
If you want to do this from a cron job, it is easily achievable. Below is a sample crontab file edited with the appropriate unmap commands. Crontab file is located at /var/spool/cron/crontabs/root
The unmap command is a handy tool that VMware administrators need to have in their short list of housekeeping procedures especially if you are thin provisioning VMs and deleting/creating VMs often as blocks will not be returned to the Equallogic SAN. However, if you have your alerting setup correctly either in group manager or SAN HQ, you should start getting caution notifications at 85% space used.
Sources: VMware KB about issue