Just recently, I’ve had another one of my hard-drives crash on me. Thankfully, it wasn’t an out and out crash, but there were certain sections of the disk that I wasn’t able to access. Thankfully, I was still able to get some of my data off.

However, considering the drive is only four months old, and still covered by warranty, I naturally want to send the drive back in for compensation. However, there is already four months worth of data on the drive, most of it of a personal nature. The last thing I want is for someone to go copying my photos and documents of the drive and posting them on the ‘net.

Thankfully, Linux (specifically, Ubuntu 10.04) has a great little built in tool that handles stuff like this for me.

Connecting the drive

So, first of all, you need to get the drive connected. Obviously, if you’re running off a laptop (like me), then it’s not as simple as plugging another drive in. Thankfully, I have a number of external hard-drives which I could use to plug the damaged drive in, which means I’m basically plugging it in as a USB drive. Alternately, you could plug the damaged drive in as your main drive, and boot off the Live CD.

Removing any automatically mounted partitions

I know with my Ubuntu installation, whenever a USB or external drive is plugged in, the partitions found on the drive are automatically mounted. These partitions will need to be unmounted. Obviously, if your installation doesn’t automatically mount the partitions, then you can skip this step.

Otherwise, you’ll need to ensure you unmount all the automatically mounted drives. I needed to unmount all the partitions that where mounted for device /dev/sdb.

Performing the data erasure

Once you’ve unmounted all the partitions, and know which device it is you want to clean, you’re now able to perform the cleanup. This is a simple case of running the following command:

sudo shred -vfz 7 /device/name

Merely replace /device/name with the corresponding name on your machine, and replace the number 7 with the number of passes you’d like to perform when erasing data. The higher the number, the more secure the data wipe, and the more time that is required to perform the erasure.

From my personal attempt at erasing the data on my drive, it took about 2 days to wipe a 250GB drive when making 7 passes. I initially wanted to make 100 passes, but I reckon that could have taken more than two weeks to wip, and I’m not that paranoid about data, nor is the data that sensitive.

So, now you know of one way to erase data on a hard drive. Obviously, f the person that has gained access to your drive is really determined, and has advanced enough software, they will be able to get your data. This is merely to stop the average Joe from snooping around your personal data. If you really want secure data shredding, try melting your drive down to a little metal ball :)

Image courtesy kennymatic.