Site icon Virtual Maestro

What is TRIM/UNMAP in vSAN 6.7?

Advertisements
Before we talk about vSAN Trim//Unmap, let’s do quick recap about thin and thick provisioning.
In this example below, VM1 is thick provisioned and VM2 is thin provisioned. VM1 was allocated 40 GB as disk space at the time of creation. Since it is thick provisioned, entire 40 GB space is occupied by VM1 from underlying datastore even if the current requirement is less. This approach can lead to underutilisation of datastore capacity due to overallocation.
Whereas, the thin-provisioned VM2 disk occupies only 20 GB of storage which is current requirement (assumed) as per data even though VM2 was also allocated 40 GB at the time of creation. As the disk requires more space, it can grow into its entire 40 GB provisioned space on demand basis.

vSAN by default uses thin provisioning for VMs that are on vSAN datastore as the SPBM Policy for Object Space Reservation is set to its default of 0%.

One challenge to thin provisioning is that VMDK’s once grown will not shrink when files within the guest OS are deleted. This problem is amplified by the fact that many file systems will always direct new writes into free space. A steady set of writes to the same block of a single small file will eventually use significantly more space at the VMDK level.

Previous solutions to fix this problem requires manual intervention and storage vMotion to external storage, or powering off a virtual machine.

To solve this problem, automated TRIM/UNMAP Space reclamation was created for vSAN 6.7U1.

What is TRIM/UNMAP

  • For efficient usage of storage space, modern guest OS filesystems have had the ability to reclaim no longer used space using what are known as TRIM/UNMAP commands for the respective ATA and SCSI protocols.
  • vSAN 6.7 U1 now has full awareness of TRIM/UNMAP command sent from the guest OS and can reclaim the previously allocated storage as free space.
  • This is an opportunistic space efficiency feature that can deliver much better storage capacity utilization in vSAN environments.
  • Trim/UNMAP support is disabled by default in vSAN. Trim/UNMAP support is enabled using the RVC Console.
How to Enable TRIM/UNMAP:
  • Login to RVC as shown in below image.
  • Navigate to computers directory under datacenter where vSAN cluster is located.
  • Run below command to enable TRIM/UNMAP.
Benfits of TRIM/UNMAP
  • This process helps to free up storage space
  • Blocks that have been reclaimed do not need to be rebalanced, or re-mirrored in the event of a device failure.
  • Read Cache can be freed up in the DRAM client Cache, as well as the Hybrid vSAN SSD Cache for use by other blocks. If removed from the write buffer this reduces the number of blocks that will be copied to the capacity tier.

VM requirement:

  • A minimum of virtual machine hardware version 11 for Windows
  • A minimum of virtual machine hardware version 13 for Linux.
  • disk.scsiUnmapAllowed flag is not set to false. The default is an implied true. This setting can be used as a “kill switch” at the virtual machine level should you wish to disable this behavior on a per VM basis and do not want to use in guest configuration to disable this behavior. VMX changes require a reboot to take effect.
  • The guest operating system must be able to identify the virtual disk as thin.
  • After enabling at a cluster level, virtual machines must be power cycled.
Microsoft Specific Guidance:
Windows Server 2012 and newer support automated space reclamation. This behavior is enabled by default.
  • To check this behavior, the following PowerShell cmdlet can be used.

Get-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\FileSystem” -NameDisableDeleteNotification

  • To enable automatic space reclamation:

Set-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\FileSystem” -NameDisableDeleteNotification -Value 0

Exit mobile version