Skip to main content

Windows Space Reclamation (fstrim/SCSI discard)

Summary

In some cases you can have a situation where your Windows Host will show that you have X amount of free space but the S1 Array will show considerably more space in use or possibly a full volume.  In these situations you may need to enable space reclamation from the Windows Host. 

Requirements

Administrator access to your Windows Host.

Steps

Windows 2008R2 / 2008R2 SP1

Windows 2008R2 and 2008R2 SP1 need a tool added to the system that is available from technet here:  https://learn.microsoft.com/en-us/sysinternals/downloads/sdelete

Windows 2012, 2012R2, and 2016

Windows 2012, 2012R2, and 2016 are supposed to natively support space reclaim but it can be disabled.  

From PowerShell you can verify buy running:

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


You should see output like this:

DisableDeleteNotification : 0

PSPath                    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
PSParentPath              : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control
PSChildName               : FileSystem
PSDrive                   : HKLM
PSProvider                : Microsoft.PowerShell.Core\Registry


If DisableDeleteNotifications is equal to 1 then for some reason unmap is disabled. It can be enabled doing:

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


2012, 2012R2, and 2016 also have a command from powershell to run “ReTrim” that looks like this:

Optimize-Volume -DriveLetter X -ReTrim –Verbose


(obviously substituting the DriveLetter option for whatever drive you have the S1 mounted to)


In Windows 2012 running defrag /L is supposed to have the same effect as the Optimize-Volume commandlet.  So that would be:

 defrag Q: /L