VMFS UNMAP is one of those features that was introduced with vSphere 5.5, where one can reclaim unused storage blocks on a VMFS datastore for a thin-provisioned device.
Well, what does that exactly mean?
Let's break it down in simple terms. Let us assume that you have a thin-provisioned LUN that was carved from the storage array and presented to the ESXi hosts in your vSphere environment.
Now, in your vSphere environment, you have created a VMFS datastore out of this thin-provisioned LUN and have VMs running on them.
But the catch is that this will not work with every storage array. This will only work with thin provisioned LUNs that support the VAAI UNMAP primitive.
Okay. I get that! How do I check if my datastore supports VAAI UNMAP primitive?
Well, there is a command that you can use as seen below to check if the thin-provisioned LUN supports VAAI UNMAP primitives?
'esxcli storage core device vaai status get -d <naa>'
In the example above, if you see the Delete Status, it is shown as Unsupported, which means my LUN is not capable of handling VAAI UNMAP primitives.
Let us assume that it did support as this is my lab environment and I use virtual storage, it was difficult to recreate the exact same requirements.
Up until now, one had to manually run a command from the esxcli namespace to reclaim the unused storage blocks.
That has changed with the new release of vSphere 6.5 and along with comes the new VMFS6 filesystem.
The manual steps would still work and below is the example of a command that you would have to use this if you are running on vSphere 6.0 and below.
esxcli storage vmfs unmap -l DatastoreName
So instead of this manually every time and you wouldn't be sure as to how much space can be reclaimed, VMware has introduced this feature in VMFS6 where in this setting will be enabled by default and will keep running in the background.
And I know how useful it is because I deal with a lot of customers and this was definitely one of the features that were most commonly asked by them.
How would I know if VMFS UNMAP is enabled?
First of all, as I mentioned before to leverage this feature, you would have to have VMFS6 datastore as this isn't going to work on the lower versions.
As mentioned before, every VMFS6 datastore will have this feature enabled by default and will be set to Low.
If you click on Edit, you will get the option to set it to None as well.
But there two more options called Medium and High that are not available from the GUI. This can only be set using the esxcli namespace.
To check the current configuration of the Automatic reclaim (VMFS UNMAP), use the below command (ISOs is the datastore name here).
esxcli storage vmfs reclaim config get -l ISOs
To change the value to either High or Medium, use the below command.
esxcli storage vmfs reclaim config set -l ISOs -p high
But I would highly recommend not to change as it most cases, the Low value to take care of the reclamation of the unused blocks.
I hope this has been informative and thank you for reading!
3 Comments
Hi Adil, Your Post is very informative and educating. Thanks for the detailed post!!
I have a query, please guide me if you are aware of it. Also I need some help incase you are free to check.
> Do we have such type of option in 5.x too? And once we set it to Medium/Low will the action begun? I mean does the reclaim on the storage array gets initiated automatically and show us free space on the disks?
Hi Vasu,
This option is only available in VMFS 6. The space reduction should be seen on the array, not on the datastore.
Hi Adil,
I went through some vSphere pCLi scripts over the net and found one which is editable as required. I am looking to minimize the manual effort for VM admins so that UNMAP works faster. Only thing here is I cant test that script as I donot have any test environment in our firm. Please suggest what changes can be made so the script works on every single host one at a time and does unmap operation on datastores mapped to that particular host when the script is executed