What is the different between sdelete -c and -z?

I think this is a common mistake. Maybe the -z option was not available in earlier versions. SDelete 1.61 says

-z         Zero free space (good for virtual disk optimization)

Note that doing so will first expand your hard disk to the full size. Only in the shrinking process by VMWare it will become smaller again.

A quick test on my machine:

-z took 1:01 minutes
-c took 2:11 minutes

Which indicates that -z only writes simple zeros whereas -c is the military standard wiping DoD 5220.22-M as written on the SDelete website.


Current documentation (and program version 2.01):

  • -c: Clean free space. Specify an option amount of space to leave free for use by a running system.
  • -z: Zero free space (good for virtual disk optimization).

But in older versions it was reversed:

  • -c: Zero free space (good for virtual disk optimization).
  • -z: Clean free space.

enter image description here

But what do they do?

Clean creates the largest file it can, and fills it with random data, and then fills it with zeros. This is what most people think of as wiping, and it's overkill.

The downside is that if you are using a virtual disk, or inside a virtual machine, or running it on a storage space: the underlying storage system will be forced to allocate resources to hold you random data, and then hold zero. Hopefully then the underlying storage system will realize that all that space that was just allocated to your drive can be reclaimed because all those sectors simply contain zeros.

-z Zero: Simply writes zeros to all sectors. This is the option you want, for many reasons:

  • wiping with random data is overkill (reading data is not practically possible; i.e. one bit at a time though a microscope is not feasable)
  • some SSDs can detect that you are writing zero to a sector, and can use that to mark the sector as free (similar to a TRIM)
  • most virtual storage systems (VMWare, Hyper-V, Windows Virtual Disks, Storage Spaces) realize that you are writing an entire sector of zeros, and take the opportunity to reclaim space in the underlying storage file
  • SSDs won't know that your ultimate goal is essentially a glorified TRIM, and (like the virtual disks) be forced to fill sectors that already contained zeros, with non-zeros, only to have you fill it with zeros again. That's terrible for your SSDs.

Source: Mounted a virtual hard disk, and watched the I/O operations that sdelete took in both modes.

tl;dr: Use -z Zero. It's faster, better, safer.


This should have been more appropriately posted as a comment to Thomas' answer, but since I cannot do that yet, I post it here.

Mixing up the "-z" and "-c" options is probably a "common mistake", because SDelete has changed the behavior of said options over the years. Looking at the below provided references it seems that SDelete first had a "-z" option which did the "military standard wiping", then added a "-c" option for zeroing free space, and then somewhere between v1.51 and v1.61 switched that behavior to the current one.

References: sysinternals.com Forum and old SDelete homepage on Microsoft TechNet via archive.org.