I've had a couple of questions concerning UNMAP and dead space reclamation, in VMware vSphere. We know this also as “TRIM” on Windows and other systems. While in the past, the mechanism of space reclamation was able to reclaim dead space from a thinly provisioned array, but also from thin provisioned VMs (or rather their VMDKs), the process was rather rudimentary, via CLI, and manual. Over the years, newer vSphere releases have added some improvements there.
The different vSphere versions in the past were able to handle the UNMAP command, first via CLI, then via GUI (starting vSphere 5.0 I believe). How is it now in ESXi 6.7 U1? The 6.5 got support to UNMAP and at the same time, we could use changed block tracking (CBT). Thig which were not possible in previous release.
ESXi supports the unmap commands issued directly from a guest operating system to reclaim storage space. Depending on if you have your datastore formatted with VMFS 5 or VMFS 6 the behavior differs.
How does it work?
When you delete some files within a VM, you free up some space. The guest operating system (OS) notifies VMFS about that newly available free space and sends an unmap command. The unmap command sent from the guest operating system releases space within the VMFS datastore. After that, the command is passed to the array level, where the array can reclaim the freed blocks of space.
For VMFS 6 – VMFS 6 uses SESparse format for delta disks, which is more space efficient and supports a space reclamation technique. Here are the details.
Quote from VMware vSphere 6.7 documentation set:
VMFS6 processes the unmap request from the guest OS only when the space to reclaim equals 1 MB or is a multiple of 1 MB. If the space is less than 1 MB or is not aligned to 1 MB, the unmap requests are not processed.
For VMs with snapshots in the default SEsparse format, VMFS6 supports the automatic space reclamation only on ESXi hosts version 6.7 or later. If you migrate VMs to ESXi hosts version 6.5 or earlier, the automatic space reclamation stops working for the VMs with snapshots.
VMFS 5 – some limited OS can proceed with the command automatically, but you must initiate the unmap command to the array via CLI by issuing esxcli storage vmfs unmap command.
There are also some requirements, which are as follows:
- The virtual disk must be thin-provisioned.
- Virtual Machine hardware version 11 (ESXi 6.0) or later. (VMX-11). For Linux HW version 13.
- The advanced setting EnableBlockDelete must be set to 1.
- The guest operating system must be able to identify the virtual disk as thin.
Where To check the configuration within vSphere?
In vSphere 6.7 the space reclamation settings are ON, and are set on “Enable Space Reclamation at Fixed Rate”.
As you will see, it is “per-datastore” option.
You connect via vSphere client, chose Storage > click your Datastore > General > Space Reclamation.
You can change the fixed values or you can disable completely the UNMAP feature if you have some particular reason. You are able to change the values of the Space Reclamation rate from 100MBps to 2GBps.
Maybe you could check a documentation from your storage array vendor on the best setting? As what I heard, VMware worked on this feature in conjunction with many array vendors and settings may vary.
Carefully when your array has only spinning media (or hybrid). Check to see which value you should enter, with your vendor.
Check settings via CLI?
Yes, we can. There is a command:
esxcli storage vmfs reclaim config get –volume-label <volume-name>
Which types of datastore are supported?
- VMFS 6 (1Mb Block/page)
- NFS (check with the vendor support)
- VSAN support at the Guest OS level
How about on VMware vSAN?
Yes, VMware vSAN does also support automatic UNMAP and with the latest release of vSphere 6.7 U1 there were enhancements made to the mechanism. You'll have to go to Ruby vSphere Console (RVC) to disable this at cluster-wide level. (please correct me if I'm wrong on this).
vSAN thin provisioning has to first set the SPBM Policy for Object Space Reservation (OSR) to its default of 0.
You can read all the details from this blog post at VMware, published by John Nicholson.
Quote from the post:
This feature is enabled initially globally for the cluster. This feature may be disabled with a customer VMX configuration setting, or by disabling it within the guest operating system.
VMware vSAN 6.7U1 introduces automated space reclamation support with TRIM and SCSI UNMAP support. SCSI UNMAP and the ATA TRIM command enable the guest OS or file system to notify that back-end storage that a block is no longer in use and may be reclaimed. vSAN does not use LUNs or VMFS, so this does not require multiple layers of reclamation like traditional storage.
Wrap Up: We have just scratched the surface. There are also CLI commands to check the configs of your datastores (if you have many). You will certainly find more useful resources if needed. This post was meant to be just an education resource on what's available and how it works. If you want to dig deeper, you certainly can.
The dead space reclamation for thin provisioned VMs, just a few years ago, haven't really worked, or not quite well. Not only that VMware did not have that feature, or did worked, but not as it should, but also due to OS support.
But again, I'm not a storage specialist, just general tech guy … -:).
Check out VMworld 2018 session – “Better Storage Utilization with Space Reclamation/UNMAP [HCI3331BU]”
VMware vSphere 6.7 U1 Buy/Download links:
vSphere All Editions – different versions of vSphere
VMware vSphere 6.7 U1 Essentials PLUS – full vSphere suite for SMB
VMware vSphere 6.7 U1 Essentials – Good way to start, for small shops.
Per Incident Support Click Here
VMware vCenter Server 6.7 U1 Download
VMware vSphere Hypervisor (ESXi) 6.7 U1 Download
More from ESX Virtualization
- Veeam Availability Suite 9.5 U4 and VeeamON Virtual Details
- VMware vSphere 6.7 U1 Download Now
- What is The Difference between VMware vSphere, ESXi and vCenter
- What is VMware Memory Ballooning?
- Upgrade ESXi To The Latest Version Without Any Software Download
- How to Patch VMware vCenter Server Appliance (VCSA) 6.7 Offline
- How To do a Dry Run of an esxcli Installation or Upgrade on VMware ESXi
Stay tuned through RSS, and social media channels (Twitter, FB, YouTube)
Excellent post as usual.
Just a question: you always speak about thin. What unmap on thick?