Loading Posts...

Storage Reclamation from SCSI UNMAP command in VMware

VMware supports to reclaim the deleted thin provisioned Storage blocks from UNMAP commands also known as SCSI UNMAP command. This VAAI storage reclamation primitive feature has been introduced in vSphere 5.0 for the first time. This feature was introduced to reclaim deleted blocks effectively from the storage. Initially it was designed to reclaim the space from the storage soon after deleted or migrated a Virtual Machine from the Storage, but there were some issues in this approach and VMware advised to disable this feature in 5.0.

This automatic reclamation process was disabled in ESXi500-201112001 (ESXi 5.0 Patch 02) and ESXi 5.0 Update 1 which means storage vMotion, deletion, snapshot consolidation or any other process stopped the automatic storage reclamation after this patch version and 5.0 U1. It was a manual process in vSphere 5.5 and now it has been automated in vSphere 6.0 with improvements.

What is the meaning of Storage Reclamation in a simple word?

Once you perform an operation like Virtual Machine Deletion, Storage vMotion or Snapshot Consolidation you free up the space of the VMFS datastore from the thin provisioned virtual disks. These operations leave blocks in the storage array allocated and shows as allocated in the capacity. This is due to the array does not know these blocks have been deleted and cleared from the space, storage has to release these blocks to show the actual deleted space in the storage. These UNMAP commands manually inform to the storage array that there are some deleted blocks in the storage array and you are free to clear up the space.

As I mentioned, this was automated in vSphere 5.0 and VMware stopped after experiencing some serious issues. Now again, this has been automated in vSphere 6.5. In vSphere 5.5 it was a manual process and introduced a new command.

esxcli storage vmfs unmap <Volume_Label or UUID>

Previously, in 5.1 it was using vmkfstools -y <percentage_to_reclaim> (however, you won’t be able to see the options in vmkfstools –help option), I have been using these two commands in my environments as I had to work with both 5.1 and 5.5 ESXi hosts.

Let’s see how we can execute these commands in vSphere 5.5 and 5.1 ESXi hosts.

Executing SCSI commands in ESXi 5.5 Host to reclaim the deleted blocks

Open a putty session to an ESXi host and execute the esxcli storage vmfs unmap -l <datastore_name>

I had to cut off the datastore name

This command will take sometime to complete the operation and it depend on the size of the datastore. Once you execute the command .asyncUnmapFile file will be created in the datastore. This file will delete after completion of the operation. In case if the operation is interrupted before the completion, this file left in the datastore and you have to run the command again against the datastore, file will delete once it complete the operation. This is the only option to check the status of the operation.

Executing SCSI UNMAP commands in ESXi 5.1 ESXi hosts

As I mentioned this esxcli commands introduced in vSphere 5.5 and vmkfstools is the command for this UNMAP operation. Change the directory in to the datastore which you need to reclaim and execute vmkfstools -y <percentage_of_the_deleted_blocks_to_reclam> (vmkfstools -y 60)

esxcli command will not work

VMFS 6 new features with automatic space reclamation

In vSphere 6.5 you have the option to set the reclamation priority in the datastore. However you can disable and set the priority only to Low for the reclamation

If you need to turn this automatic reclamation feature off set the priority to None from Low.

Storage Reclamation from SCSI UNMAP command in VMware
5 (100%) 4 vote[s]

Aruna Lakmal

Associate Technical Lead at Pearson, Sri Lanka. Technology junky, enthusiast, a VMware vExpert and a blogger with more than 6 years of Experience in Information Technology more focusing on VMware Virtualization, Microsoft and Datacenter Technologies.

Get Updates Directly To Your Inbox!

   

Show 7 comments

Leave a Reply

Loading Posts...