One challenge inherent in storage arrays that present Thin Provisioned volumes is how the various operating systems that use those volumes indicate that data has been deleted. This is referred to as Dead Space Reclamation and is provided by one of two techniques: SSD Trim or SCSI Unmap.
This process enables you to reclaim blocks of thin-provisioned LUNs by telling the array that specific blocks are obsolete. Most legacy operating systems inherently do not provide this capability, so special attention needs to be paid if a Host performs large delete operations without rewriting new data into the deleted space. Most current operating systems, such as ESX 5.x+, Windows 2012, 2012 R2, 2016 and RedHat Enterprise Linux 6 provide this functionality.
TRIM is not a command that forces the SSD to immediately erase data. The TRIM command simply notifies the SSD which Logical Block Addresses (LBAs) are no longer needed. The SSD takes those addresses and updates its own internal map in order to mark those locations as invalid. With this information, the SSD will no longer move that marked invalid block during garbage collection (GC); thus eliminating the time wasted in order to rewrite invalid data to new flash pages.
- Lower write amplification -- Less data is rewritten and more free space is available during GC
- Higher throughput -- Less data to move during GC
- Improved flash endurance -- The drive is writing less to the flash by not rewriting invalid data during GC
- Keeps SSDs Trim -- As an SSD comes close to full, there is a substantial slowdown in write performance as more flash cells must undergo Program/Erase (P/E) cycles before data can be rewritten.
- Reduce FlashArray processing -- A lot of resources are used for wear leveling, so more free blocks can help dynamic wear leveling algorithms.
SCSI UNMAP is the full equivalent of TRIM, but 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.
SCSI UNMAP Benefits
- Beneficial to thinly provisioned storage pools as reclaimed blocks will be put back into the unused pool
- Avoid out of space condition for thinly provisioned pools of storage
- Automatic operation that no longer needs to be run manually on host
- No longer need to run backend array tools to perform thin reclamation (zero page reclaim) that consumed valuable array cycles and potentially slowed down host performance
Using TRIM and UNMAP
Microsoft Windows Server 2008 R2 and 2008 R2 (Service Pack 1)
Windows Server 2008 R2 and 2008 R2 (Service Pack 1) do not natively provide the capability to reclaim space. Microsoft has provided an alternative through a tool called sDelete. This tool can be downloaded from TechNet. After downloading and extracting the sDelete.zip file contents there is an sdelete and sdelete64.
If FlashArray utilization is high (80-90%), Garbage Collection (GC) will handle the space clean-up after host side deletion. Be aware that GC could take some time to complete.
sDelete is a command line utility that allows you to delete one or more files and/or directories, or to cleanse free space on a logical disk. sDelete accepts wild card characters as part of the directory or file specifier.
usage: sdelete [-p passes] [-s] [-q] <file or directory> ... sdelete [-p passes] [-z|-c] [drive letter] ... -a Remove Read-Only attribute -c Clean free space -p passes Specifies number of overwrite passes (default is 1) -q Don't print errors (Quiet) -s or -r Recurse subdirectories -z Zero free space (good for virtual disk optimization)
When utilizing the -z option, a balloon file is generated. Please evaluate the space available before performing this option.
Example of this command:
PS C:\Users\Administrator\Downloads\SDelete> .\sdelete64.exe -p 1 -s -z D: SDelete v2.0 - Secure file delete Copyright (C) 1999-2016 Mark Russinovich Sysinternals - www.sysinternals.com SDelete is set for 1 pass. Cleaning free space on D:\: 100%
Microsoft Windows Server 2012, 2012 R2 and 2016
Windows 2012, 2012 R2 and 2016 natively supports the capability to reclaim space is enabled by default. To check if DisableDeleteNotification is enabled on the Windows Server host run the following Windows PowerShell.
Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification DisableDeleteNotification : 0
Set Enable Value
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification -Value 0
Set Disable Value
It is not recommended to disable delete notification.
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\FileSystem" -Name DisableDeleteNotification -Value 1
Windows Server 2012, 2012 R2 and 2016 has a new Windows PowerShell cmdlet, Optimize-Storage, which provides the ability to manually perform the following actions:
- TRIM -- The parameter is -ReTrim which generates TRIM and Unmap hints for all currently unused sectors of a volume. This in turn will purge the no longer needed sectors on the FlashArray and will recover unused capacity.
- Defragment --
- Consolidate slabs --
- Tier Optimize -- This is not applicable to FlashArray volumes because we do not recommend the use of Storage Spaces. Storage Spaces creates a storage pool with a set of drives, typically Direct Attached Storage (DAS). The Pure Storage FlashArray provides all of the capabilities and more that Storage Spaces provides.
There is another option to run ReTrim on volumes using defrag /L. This performs the same action as the Optimize-Storage PowerShell cmdlet.
Example of using TRIM (ReTrim):
PS C:\> Optimize-Volume -DriveLetter G -ReTrim –Verbose VERBOSE: Invoking retrim on boneyard3 (G:)... VERBOSE: Performing pass 1: VERBOSE: Retrim: 0% complete... VERBOSE: Retrim: 1% complete... .... VERBOSE: Retrim: 99% complete... VERBOSE: Retrim: 100% complete. VERBOSE: Post Defragmentation Report: VERBOSE: Volume Information: VERBOSE: Volume size = 5.99 TB VERBOSE: Cluster size = 4 KB VERBOSE: Used space = 212.65 GB VERBOSE: Free space = 5.79 TB VERBOSE: Retrim: VERBOSE: Backed allocations = 6143 VERBOSE: Allocations trimmed = 5936 VERBOSE: Total space trimmed = 5.78 TB PS C:\>
Below is an example of running the Optimize-Volume cmdlet with the -ReTrim parameter:
Introduced with Windows Server 2012 defrag /L performs the same TRIM (-ReTrim) as the Optimize-Storage PowerShell cmdlet. Below is an example of using this option over the PowerShell cmdlet.
PS C:\> defrag G: /L Microsoft Drive Optimizer Copyright (c) 2013 Microsoft Corp. Invoking retrim on Volume01 (G:)... The operation completed successfully. Post Defragmentation Report: Volume Information: Volume size = 5.99 TB Free space = 5.79 TB Retrim: Total space trimmed = 5.78 TB