Tuesday, January 8, 2008

Shred a Hard Drive with Linux.

Windows does have a handy hard drive formatter built into it's OS, but chances are it only does one pass of "Zeros." Also this built in formatter is pointless if it's your boot disk that you want to erase. This is where Linux Live (bootable) CD/DVDs become extremely helpful.

Knoppix was the first Live Linux Distribution (Live meaning you can boot and run Linux right from the CD or DVD) that I knew of, but now it seems that almost ALL major Linux Distro's have some sort of Live CD feature. This tip should work on all Linux distro's (such as Ubuntu and so on) but I've only tested it on Knoppix.

At work we do a lot of shredding of our hard drives in order to dispose of sensitive data, and it's incredibly easy using a Live Linux CD.

First off, I'd just like to make a note that this will delete ALL your data, so use at your own risk.

1.) Acquire the latest Knoppix or Ubuntu.

2.) Boot the computer that you want to shred (completely erase) the hard drive of. To avoid confusion, I recommend to have ONLY the hard drive that you want to shred installed. However this is not required, whereas you can invoke several commands to figure out which hard drive is which.

3.) Once you have booted into the Live CD/DVD, open Terminal.

4.) Enter the following commands:

fdisk -l

The first command lets you become the Root User, or "Super User," and gives you permissions to do commands, such as fdisk and shred. The second command will list all of the hard drives currently mounted.

If you followed my recommendation and have only one hard drive installed, you should only see either "Disk /dev/hda" or "Disk /dev/sda" (hda for the old ATA drives, and sda given to newer SATA drives). However if you happened to have multiple hard drives still in your computer, you will see hda and hdb (and so on) AND/OR sda and sdb (and so on). This output is very important to you if you do infact have multiple hard drives installed because this will show you statistics on these hard drives (size, partitions, etc.).

So find out which hard drive you want to shred and continue on to Step 5.

5.) You should still be logged into "Super User," but if not type su (note: this won't hurt if entered a second time).

6.) Now for the shred command, make sure to type this 100% since this will erase everything.

7.) The command you will need to enter is:

shred -vfz -n 3 /dev/hda

-The -v argument stands for "verbose" and this means that you will be prompted with the progress of the shred.
-The -f argument tells Terminal to force the command.
-The -z argument is telling the shred command to add a final overwrite of all zero's (this means that the hard drive will be completely erased).
-Finally the -n option is there so you can specify the number of iterations that the shred preforms. The more the better... well kind of. All moving parts (hard drives OBVIOUSLY included) have life spans, and making the hard drive do more intensive work, such as shred, logically would limit the life span of the hard drive that much. Most people say 3 to 5 passes are plenty.
-Lastly, make sure to change the /dev/hda to either (/dev/hda, /dev/hdb, /dev/hdc, /dev/sda, /dev/sdb, /dev/sdc, etc.) to make sense with your situation.

Once completed, you'll be able to format the drive (most OS'es do this automatically for you when installing their OS) and install a fresh copy of an OS of your choice!


Dave said...

This is a very handy tip. Generally for this task I used to use a program called KillDisk, however the issue with this was that it would only allow I believe 1 passthrough of zeroes and if you required more than that you would need to obtain a license for the software. So thanks for the heads up Jonathan! Also, change the name of your blog, Hello World is so cliche.

am1ptor said...

Would it not be easier to just get a freeware hard drive erasing tool and use a USB docking bay and switch out the drives after you erase them with it? Sounds like your idea is to boot up a computer with the drive mounted internally and erase the data, then shut down, and repeat. Some people go a bit too overboard on erasing data when it is actually a lot simpler than one would think.

javieth said...

I had a problem with my hard disc few time ago, how ever i could solve the problem and now my computer is really nice. after that i could see costa rica homes for sale and i loved too much because i always have been interested in visit this beautiful country.

Rufus said...

Shred is a great tool for Linux users, however it just takes far too long, especially if your hard drive is anything more than 80GB. This is the reason I use a professional Hard Drive Shredding service for my business. Although personally I still use Shred myself.

Becky Wright said...

Since I don't have any idea with this, I just note all the commands and soon I can apply it on shredding my hard drive. Thanks much!

Henry said...

Thanks for sharing this useful information ,.
secure data destruction