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.
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.
- Login to RVC as shown in below image.
- Navigate to computers directory under datacenter where vSAN cluster is located.
- 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.
- 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