Windows 2012, 2012 R2, and 2016 natively support 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.
Delete Notification
Get Value
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
Optimize-Volume
Windows Server 2012, 2012 R2 and 2016 has a new Windows PowerShell cmdlet, Optimize-Volume, 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 Everpure 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:\>
If using volume mount points, use the -FileSystemLabel or -Path parameters to specify the desired volume rather than the -DriveLetter parameter, as in the following examples.
PS C:\> Optimize-Volume -FileSystemLabel e06-19-test-2 -ReTrim -Verbose
VERBOSE: Invoking retrim on e06-19-test-2 (C:\mountpoint)...
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.46 TB
VERBOSE: Cluster size = 4 KB
VERBOSE: Used space = 5.91 GB
VERBOSE: Free space = 5.45 TB
VERBOSE:
Retrim:
VERBOSE: Backed allocations = 5594
VERBOSE: Allocations trimmed = 5617
VERBOSE: Total space trimmed = 5.45 TB
PS C:\>
PS C:\>
Optimize-Volume -Path '\\?\Volume{16a3bbb0-05f9-4285-823a-5083d2e5eb22}\' -ReTrim -Verbose
VERBOSE: Invoking retrim on e06-19-test-2 (C:\mountpoint)...
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.46 TB
VERBOSE: Cluster size = 4 KB
VERBOSE: Used space = 5.91 GB
VERBOSE: Free space = 5.45 TB
VERBOSE:
Retrim:
VERBOSE: Backed allocations = 5594
VERBOSE: Allocations trimmed = 5617
VERBOSE: Total space trimmed = 5.45 TB
PS C:\>
Both the Path and FileSystemLabel can be determined with the Get-Volume cmdlet.
Defrag /L
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
Defrag /L can also be used with volume mount points by specifying the path to the mount point, as in the following example.
PS C:\> defrag C:\mountpoint /L
Microsoft Drive Optimizer
Copyright (c) Microsoft Corp.
Invoking retrim on e06-19-test-2 (C:\mountpoint)...
The operation completed successfully.
Post Defragmentation Report:
Volume Information:
Volume size = 5.46 TB
Free space = 5.45 TB
Retrim:
Total space trimmed = 5.45 TB