Deleting a file or reformatting a disk does not destroy your sensitive data. The data can easily be undeleted. That's a good thing if you accidentally throw something away, but what if your trying to destroy financial data, bank account passwords, or classified company information. What if you want to clean your computer before selling it for instance?
In this article you will learn how to use a very powerful tool, so be careful, because you could totally mess up your system. I currently use Ubuntu, but this article should work for pretty much any distribution.
About Shred
To make sure the data is unrecoverable by anyone, it needs to be overwritten. Ubuntu has got a standard tool for this called shred, you will probably find it preinstalled on your distribution as well.
The shred command lets you delete files or entire hard drives permanently by overwriting the data with random gibberish many times (25 by default). This totally destroys the original data and makes it almost impossible to recover.
Using Shred
Shred Files
For shredding files you can run shred like this:
$ shred -z -u -n200 /home/kevin/company_info/*
-z
overwrite with zero's the last time, to mask the shred process.-u
means delete when you're done overwriting-n200
means overwrite 200 times
Shred Drives
Some things that I'm going to change for this operation:
- Overwriting 200 times might take too long when overwriting an entire drive, so let's overwrite it 10 times.
- The device itself can't be deleted so the
u
argument has to leave. - We need to replace the
/home/kevin/company_info/
with your device name, which you could look up by typingdf
. - You can always concatenate arguments so I'm going to do that as well.
So now the command could look something like this:
$ shred -zn10 /dev/hda
This will totally erase everything on your hard drive. It's best to do this from a Live CD, otherwise during the first run, it will begin missing some essential system files (that of course are being overwritten) and you don't want to crash the system before totally destroying all data.
Final Remarks
Shred works best on an entire disk because there are journaling filesystems that store duplicate bytes on others places on the disk delete it.