How to Secure Delete Files, Shred Files, Wipe Drive

By Xah Lee. Date: . Last updated: .

This article tells you how to securely delete files on {Windows, Linux, Mac}.

Recently i need to delete a folder, full of my online passwords, financial info, etc. Moving to trash and empty trash won't work, because the data is still on disk.

Windows Shredding Tools

Windows command line tool: “cipher.exe”

Windows comes with a command line tool “cipher” (Vista, Window 7). It can be used to securely wipe deleted data. Type cipher /? for help.

[How To Use Cipher.exe to Overwrite Deleted Data in Windows By Microsoft. At http://support.microsoft.com/kb/315672 , accessed on 2012-11-20 ]

I'm not sure this can be used just for secure empty trash.

Ccleaner

Ccleaner is a easy-to-use tool. I currently use this.

Ccleaner can wipe entire drive, or empty spaces in drive.

I'm not sure this can be used just for secure empty trash.

SDelete

[SDelete v1.6 By Mark Russinovich, Windows Sysinternals. At https://docs.microsoft.com/en-us/sysinternals/downloads/sdelete [was http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx accessed on 2012-11-20 ]]

Recommended.

In the end, i just settled on SDelete. It's from Mark Russinovich of Sysinternals fame, who also wrote Process Explorer (i highly recommend).

From the SDelete's home page, it start with this paragraph, which goes to show how complex file erasure are these days:

One feature of Windows NT/2000's (Win2K) C2-compliance is that it implements object reuse protection. This means that when an application allocates file space or virtual memory it is unable to view data that was previously stored in the resources Windows NT/2K allocates for it. Windows NT zero-fills memory and zeroes the sectors on disk where a file is placed before it presents either type of resource to an application. However, object reuse does not dictate that the space that a file occupies before it is deleted be zeroed. This is because Windows NT/2K is designed with the assumption that the operating system controls access to system resources. However, when the operating system is not active it is possible to use raw disk editors and recovery tools to view and recover data that the operating system has deallocated. Even when you encrypt files with Win2K's Encrypting File System (EFS), a file's original unencrypted file data is left on the disk after a new encrypted version of the file is created.

How to Use SDelete

Here's a example of how i used SDelete:

sdelete -p 1 -s "c:\Users\xah\Documents\my secrets\"
sdelete -p 1 -z -c "C:"

Note, that the second line took some 4 hours for a 200 giga bytes of free disk space. Though, the CPU usage is below 5%.

Here's its usage:

Usage: sdelete [-p passes] [-s] [-q] <file or directory>
sdelete [-p passes] [-z|-c] [drive letter]
-c  Zero free space (good for virtual disk optimization).
-p passes Specifies number of overwrite passes.
-s  Recurse subdirectories.
-q  Don't print errors (quiet).
-z  Cleanse free space.

Other Tools for Shredding File on Microsoft Windows

The following i have not used, but seems trust-worthy from my 2-hours research.

At first, when i found the GNU's “shred” unix command line utility, and i thought i need look no further. Because i have Cygwin installed on my Windows, and the program is there. I tried it, it works. However, reading its man page, quote:

CAUTION: Note that shred relies on a very important assumption: that the file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:

* log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.)

Most file systems are journaled in one way or another. So i can't say what's the relevance of “shred” anymore.

Some other tools mentioned above also seems noteworthy, many are open source, but often years old. In the 10 min or so i spent reading about each, i can't make sure they still work in Microsoft Vista. (open source ones are especially bad like that)

File shredding tools are low level, so you better be sure, else they screw up your files or disk partition and it's gonna be a big headache. Also, of course, make sure you backup first.

Apple Mac OS X

On the Mac, just use the menu [Finder ▸ Secure Empty Trash].

The command line equivalent is “srm”. Like this: srm -r -s dir_path. The “-r” means all content in the dir, including sub dir. The “-s” means just overwrite once.

Linux

On linux, use the program “shred”. See man shred.

Wipe Once is Enough!

In file shredding articles i've read in the past decade, it is said, that to be absolutely safe, you must overwrite the file n times, n being like 3 or 10 or more. WRONG!

One surprising thing i learned in one of the article is that, one time is enough today! I find that convincing. (see article below)

Some quotes from Data remanence:

Daniel Feenberg, an economist at the private National Bureau of Economic Research, claims that the chances of overwritten data being recovered from a modern hard drive amount to "urban legend".[3]

As of November 2007, the United States Department of Defense considers overwriting acceptable for clearing magnetic media within the same security area/zone, but not as a sanitization method. Only degaussing or physical destruction is acceptable for the latter.[4]

On the other hand, according to the 2006 NIST Special Publication 800-88 (p. 7): “Studies have shown that most of today's media can be effectively cleared by one overwrite” and “for ATA disk drives manufactured after 2001 (over 15 GB) the terms clearing and purging have converged.”[1] An analysis by Wright et al. of recovery techniques, including magnetic force microscopy, also concludes that a single wipe is all that is required for modern drives. …

What is Data Sanitization?

Many articles uses the term Sanitization instead of just secure shred, wipe, erasure. What the faak is with that? In short, it's basically a term used in government organizations borrowed from paper documents. It doesn't mean much other than emphasizing the highest degree of data security.