by lunarg on August 31st 2015, at 12:10

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:

  • It cannot handle mount points, only logical drives (i.e. volumes mounted on a logical drive letter).
  • It is rather slow on very large file systems.

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
« May 2024»
« Smith & Wesson - the original point and click interface »