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](../../I/static/images/2a6dc836a18111e1628b2f0ae4d2a756a30a4ee96ebe63cf4dcefac90c951181.png)
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.
1VMWare Workstation Pro 12 does expand the disk to full size, unfortunately. – Lebenita – 2015-08-27T23:59:17.903
1-c and -z were advertised in 1.51 exactly the other way around (whether that was just an error in the description or the functions were also reversed I don't know). The 1.61 way makes a lot more sense, obviously. – Lebenita – 2015-08-28T00:01:47.083
Just checked with Windows 2012 and a new 20GB VHDX file. The -z option was very fast (seconds) and the VHDX disk file didn't increase in size. The -c option is running much slower and the VHDX is increasing in size. So -z is the preferred option for a so-called thin/expanding virtual hard disk especially if you've over committed disk space. But it's not as safe as the -c option – munrobasher – 2015-12-10T14:07:04.763
1Just checked the latest version (2.0) and there are two obvious differences. Firstly there is a 32-bit and 64-bit version (sdelete.exe & sdelete64.exe). But there is also a subtle difference in the -c command which worries. In v1.61, the -c option said "Cleaning free space" but in v2.0 it says "Zeroing free space". The -z option also says zeroing. Has it lost the random data option?? – munrobasher – 2017-01-17T17:38:20.547
@munrobasher: just downloaded version 2.0 and it seems identical to the post.
-z
writes0x00
and-c
does something else, which it calls "clean". – Thomas Weller – 2017-01-17T19:05:54.270I have a log captured where sdelete v1.61 with -c option says "Cleaning free space". However, when I try it now, it says "Zeroing free space" with both options. As does sdelete64 v2.00. Very confused! – munrobasher – 2017-01-23T09:47:37.697
Later - it starts off saying "Zeroing free space" but must change at some point as it now says "Cleaning free space... 32%" – munrobasher – 2017-01-23T22:57:30.417
It won’t bloat the file if the software is somewhat intelligent. Most virtualization applications are. I just tried it in VMware Fusion, it did not increase the file size at all. – Daniel B – 2014-05-01T13:11:59.170