To reclaim space in virtual environments and thin provisioned storage facilities, SDelete from SysInternals is probably the most used tool on Windows to clear out unused space of a volume, allowing the SAN to release these data blocks back to the storage pool.
But while SDelete is robust, it has a few (minor) limitations:
I found an alternative online in the form of a Powershell script at this thread, written by David Tan, who in turn based it on a script found here.
The script creates an empty ("zeroed") 1 GB file and copies that file until the free space drops to less than 1 GB, after which the empty files are deleted again. This method is much faster and also works with mount points.
Its usage is simple:
[PS] > .\NimbleFastReclaim.ps1 - Filepath- LogFile (DEFAULT=C:\temp\NimbleFastReclaim.log) - CycleWait(s) (DEFAULT=0)
Note that you may get a security prompt and/or may have to set the execution policy (Set-ExecutionPolicy RemoteSigned).
[PS] > .\NimbleFastReclaim.ps1 -FilePath K: [PS] > .\NimbleFastReclaim.ps1 -FilePath C:\path\to\mountpoint
« ‹ | November 2024 | › » | ||||
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |