vSphere 6

ESXi 6 Equallogic reclaim free space

If you are thin provisioning VMs in your VMware environment with Equallogic SAN attached, you may need to Equallogic reclaim free space manually using this process.

Highlights

  •  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.
  • 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.
  • 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.

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.

unmap01

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.

unmap02

Cron Job

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

#min hour day mon dow command
1 1 * * * /sbin/tmpwatch.py
1 * * * * /sbin/auto-backup.sh
0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py
*/5 * * * * /sbin/hostd-probe ++group=host/vim/vmvisor/hostd-probe
00 1 * * * localcli storage core device purge
30 12 * * * esxcli storage vmfs unmap -u <your datastore ID>
30 2 * * * esxcli storage vmfs unmap -u <your datastore ID>
30 4 * * * esxcli storage vmfs unmap -u <your datastore ID>
After editing the crontab you also need to kill and restart the crond process, which you can do like this:
# kill -HUP $(cat /var/run/crond.pid)
# /usr/lib/vmware/busybox/bin/busybox crond

Final Thoughts

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

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.