Most legacy operating systems integrally do not have the capability to reclaim the space when a host performs large delete operations from a thin provisioned volume without rewriting new data into the deleted space. This deletion may perform by an application or guest operating system.

Dead Space Reclamation process enables to reclaim the previously allocated blocks of thin-provisioned LUNs that are no longer in use. Those blocks that contain deleted data are unallocated and the storage array is updated.

This is performed by one of two techniques: TRIM and UNMAP, to use the storage space more efficiently.

What is TRIM & UNMAP?

TRIM is the specification for this functionality that handles all standards for ATA interfaces and UNMAP is the full equivalent of TRIM but for SCSI disks.

What is SSD TRIM?

First TRIM is not a command that forces the SSD to immediately erase data. Basically, TRIM is a command that notifies the SSD which Logical Block Addresses (LBAs) are no longer needed. The SSD takes those addresses and updates its own internal record in order to mark them as invalid. And the SSD will no longer move that records marked internally as invalid blocks during garbage collection, which eliminates the time wasted in order to rewrite invalid data to new flash pages. Trim requires physical disks directly attached to the server and trim-compatible hardware.

Download Banner

Benefits

  • Less data is rewritten, and more free space is available during the garbage collection
  • Less data to move during garbage collection and higher throughput
  • Writing less to the flash by not rewriting invalid data during garbage collection achieves improved flash endurance
  • TRIM prevents the SSD drive from making unnecessary writes and being overused

What is SCSI UNMAP?

UNMAP is the full equivalent of TRIM specifically for SCSI disks.

UNMAP is a SCSI command that a host can issue to a storage array to free Logical Block Addresses (LBAs) that no longer need to be allocated. UNMAP is used to remove physical blocks from the storage allocation in thinly provisioned Storage Array

Benefits

  • Reclaimed blocks will be put back into the unused storage pool
  • Avoid out of space condition for thinly provisioned pools of storage
  • No manual operation required on the host
  • No array tools required to perform thin reclamation in the backend

Space Reclamation with Windows Servers

Windows Server 2008 R2 and 2008 R2 SP1 do not have native capability to reclaim space and Server 2012, 2012 R2, 2016 and 2019 natively supports space reclaim and it is enabled by default.

For 2008 servers Microsoft provides an alternative a tool called sDelete, you can download it from TechNet and this is ZIP file which contains sdelete and sdelete64.

Space Reclamation in Storage Array

When a large file is deleted from the file system, the server converts file delete or trim notifications into a corresponding UNMAP request. The storage port driver stack translates the UNMAP request into a SCSI UNMAP command or an ATA TRIM command according to the protocol type of the storage device.

During the storage device enumeration, the Windows storage stack gathers information about whether the storage device supports UNMAP or TRIM commands. Only the UNMAP request is sent to the storage device if the device has SCSI UNMAP or ATA TRIM capability. Windows Server also provides an API implementation for unmapping LBAs on a storage target device.

UNMAP Requests from the Hyper-V Guest Operating System

During the virtual machine (VM) creation, a Hyper-V host sends an inquiry about whether the storage device where the virtual hard disk resides supports UNMAP or TRIM commands. When a large file is deleted from the file system of a VM guest operating system, the guest operating system sends a file delete request to the virtual machine’s virtual hard disk.

How to Check “Disable Delete Notification” is enabled on the Windows Server host

To check if DisableDeleteNotification is enabled on the Windows Server host run the following Windows PowerShell.

Get Value

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

Reclaim the Dead Space in Windows Servers

Set Enable Value

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

Set Disable Value

Set-ItemProperty -Path “HKLM:\System\CurrentControlSet\Control\FileSystem” -Name DisableDeleteNotification -Value 1

Note:- It is not recommended to disable delete notification.

Optimize Storage In Windows

To Optimize the Storage in Windows Server 2012, 2012 R2, 2016 and 2019 Windows PowerShell cmdlet is available. It provides the ability to manually perform actions like TRIM, Defragment, etc.

TRIM – The parameter is ReTrim which generates TRIM and Unmap hints for all currently unused sectors of a volume.

Reclaim the Dead Space in Windows Servers

Defrag – The parameter defrag/L performs the same TRIM (-ReTrim) as the Optimize-Storage PowerShell cmdlet

Reclaim the Dead Space in Windows Servers

Refer Microsoft docs for more details of the Optimize-Volume command.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Like what you read? Rate us
Reclaiming Space using TRIM UNMAP in Windows
Rate this post