Introduction
VMware vSAN 6.7 Update 1 was presented during VMware VMworld 2018 and became available for download recently. It is still talked over in the IT community as the update brought many new features to the platform. TRIM/UNMAP, the process for guest OS disk space reclamation, is one of those new features. To make the long story short, it enables to use the storage resources smarter once you create thin provisioned virtual disks. In this article, I discuss how to enable TRIM/UNMAP and why actually you need this feature.
What is the TRIM/UNMAP process?
Automatic disk space reclamation has been introduced back in VMware vSphere 6.5. In that version, the feature works automatically in asynchronous mode and administrator can set the priority for block reclamation:
And, that’s absolutely true that you could find this feature in vSAN before, but it was not working at all. Now, after the U1, it finally works.
Why you need it? Everyone knows that modern operating systems write data into the empty blocks but not in ones that are just marked as deleted. This mechanism helps you to easily restore data that marked as deleted. For space-saving concerns, vSAN allows creating thin provisioned disks that grow gradually as they are filled with data. However, there’s a big challenge with these disks: allocated space always grows even if the guest file system is not increasing its actual usage.
Well, that’s how you lose space, and, obviously, you want to get it back! That’s actually what TRIM and UNMAP processes are for. After U1, vSAN 6.7 proceeds all SCSI/ATA TRIM/UNMAP commands and automatically reclaims the storage space. It should be noted that these commands reach the physical storage device level directly bypassing the LUN and VMFS layers since vSAN does not involve any of those volumes in TRIM/UNMAP processes.
In addition to gaining some extra space, disk blocks reclamation has at least other three benefits:
- You do not need to waste resources for replicating between hosts the blocks that are not the part of vSAN storage.
- Backup software won’t proceed those blocks during backups.
- Clearing read cache. As a result, there are fewer blocks copied between flash cache and capacity tier.
VMware says that TRIM/UNMAP processes do not alter performance. However, if there are too many UNMAP commands, you need to keep an eye on storage infrastructure performance.
How to enable TRIM/UNMAP
Here is the cmdlet for enabling the TRIM/UNMAP process:
1 |
vsan.unmap_support VSAN-Cluster -e |
For disabling the process, set the d parameter:
1 |
vsan.unmap_support VSAN-Cluster -d |
Windows Server 2012 and later OS versions allow automatic space reclamation. Execute the following command to check whether the feature is enabled:
1 |
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification |
If you still need to enable this feature on the guest OS level, run the following command:
1 |
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification -Value 0 |
Note that blocks reclamation occurs asynchronously. That’s why it takes a while to reclaim the space. To enable TRIM for the disk in Windows environment, run the following PowerShell cmdlet:
1 |
PS C:\>Optimize-Volume -DriveLetter H -ReTrim -Verbose |
Here’s the output:
You also can TRIM with defragmentation utility. Just run it using the L flag:
Defrag C: D: /L
Where to monitor TRIM/UNMAP performance?
Now, let’s look at how TRIM/UNMAP processes impact performance. For that purpose, let’s compare the overall host performance with the feature enabled and without it. You can find performance metrics in the vSAN console by following path: Monitor->vSAN->Performance.
This plot represents two parameters:
- UNMAP Throughput – how fast UNMAP commands reach the host disk groups.
- Recovery UNMAP Throughput – how fast UNMAP commands that are parts of the object repair process are executed if the object is missing or damaged.
Conclusion
In today’s article I discussed why you need and how to enable TRIM/UNMAP process that was recently introduced in VMware vSAN with Update 1. It’s a cool feature that helps you to save some space when you use thin provisioned virtual disks.