Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Reclaiming guest OS storage in VMware vSAN 6.7 U1 with TRIM/UNMAP process

  • October 23, 2018
  • 8 min read
Virtualization Architect. Alex is a certified VMware vExpert and the Founder of VMC, a company focused on virtualization, and the CEO of Nova Games, a mobile game publisher.
Virtualization Architect. Alex is a certified VMware vExpert and the Founder of VMC, a company focused on virtualization, and the CEO of Nova Games, a mobile game publisher.

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:

https://www.vmgu.ru/content_images/vmware-vsphere-65-storage-2.jpg

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.

https://vmgu.ru/content_images/vmware-vsphere-vsan-67-update-1-9.png

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:

For disabling the process, set the d parameter:

Windows Server 2012 and later OS versions allow automatic space reclamation. Execute the following command to check whether the feature is enabled:

If you still need to enable this feature on the guest OS level, run the following command:

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:

Here’s the output:

https://vmgu.ru/content_images/vmware-vsan-trim-unmap.jpg

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.

https://vmgu.ru/content_images/vmware-vsan-trim-unmap-2.jpg

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.

Hey! Found Alex’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!