Saturday, August 2, 2008

Wipe a hard drive completely

More than half the computers donated to the Salvation Army and Goodwill still have the users' personal information on them. I suppose PCs at yard sales are just as bad. A criminal who obtains your used hard drive may find enough information to steal your identity and ruin your credit.

Deleting files or moving them to the trash doesn't really get rid of the data. It just removes the filenames from the file system. The data are still on the hard drive until something writes over it. Writing zeroes over the entire usable surface is enough. The FBI might be able to dismantle your drive and read the platters with special equipment, but it can't be done with software alone.

All Unix systems, including Linux, come with a very old, standard utility program called dd, for "disk dump." dd will copy data from any file or device to any other file or device. On Linux, there is a device name for the "master" (first) drive on the first "IDE" channel: /dev/hda. There is also a thing called /dev/zero. Any program can read data out of /dev/zero all day, and all it ever gets is an endless string of zeroes. So, guess what, use dd to copy a big pile of zeroes onto /dev/hda and the drive will be wiped clean.

Now you're saying but I never use Unix, Unix is for geeks who can't get a date, and I sure don't want to install an operating system just to wipe a drive, right? Well your old hard drive doesn't care if you're a geek. Nor do the criminals who want your data. And these days you can use Linux without installing anything. So here's the step by step:

Go to http://www.damnsmalllinux.org/download.html and choose a nearby download site, and download the file dsl-3.1.iso (or whatever version it's up to) from the "current" directory. This 50MB file took six minutes on my ADSL line. That's faster than driving to the store and buying a commercial disk wipe program.

Burn this CD image onto a CD with your favorite CD burning program. I picked Durn Small Linux because it fits on a business card CD, but you can put it on a regular CD if you like. I burn CDs with K3B (from www.K3B.org) but you might use Nero.

Insert the CD in the computer to be wiped, and boot (or reboot) the computer off the CD. There is a Durn Small Linux "splash screen" with a boot prompt boot: in the lower left. Type dsl 2 and hit Enter. Durn Small Linux takes a little while to scan your computer and figure out how to run there. It prints a bunch of chatty messages about a bunch of modules it can't find. Ignore all of that. The boot sequence ends with a command prompt root@tty1[/]# and a blinking cursor. That 2 you typed means never mind your fancy graphical hoo-ha, I just want a command prompt. So that's what it did. Try it without the 2 some other time.

Are you sure the first drive on the first IDE channel is the one you want to wipe? This operation is not reversible! Very carefully type the command

dd if=/dev/zero of=/dev/hda

and hit Enter. In English, that's disk dump, with input file /dev/zero and output file /dev/hda. There are no spaces around the slashes or the equal signs. The dd program will run until it hits the end of the hard drive. Your drive light will be on, solid. At the end it will tell you how many 1KB blocks of zeroes it wrote. You may now unplug the computer and donate the cleaned drive to charity.

Your drive is empty. Even its partition table is gone. You can create a new one with the cfdisk command. It's rather self-explanatory, especially if you have used Microsoft's fdisk before.

This trick works for standard USB flash drives, too. The first flash drive is /dev/sda. It should be recognized automatically when you plug it in.

The second ("slave") drive on the first IDE channel is /dev/hdb. You can wipe it, too.

This is not an installation. Durn Small Linux runs in RAM, and when you shut off the computer, it's gone. If your computer can't boot off a CD, or you can't create a bootable CD, you can do this disk wipe with a floppy disk and the tiny little eensy weensy Linux system known as Toms Root That Boots from http://www.toms.net/rb/. I chose Durn Small Linux because who uses floppies anymore? (And would you believe CNET's software wouldn't let me use the Bad Word in the name of that operating system? Sheesh!)

Label the CD and put it in your PC repair tool box, or give it to a friend who works on PCs.

The dd program that comes with Linux is from the Free Software Foundation, http://www.fsf.org.

No comments: