How to securely erase a hard drive using Ubuntu

If you’re thinking about selling on your PC, or even throwing it away, it is a very, very good idea to make sure that you do something about all that sensitive data that you have on its drive.

Firstly, I must say that you do this at your own risk! It is totally impossible to retrieve ANY data off the drive you’ve erased after following these procedures, so make sure you get any important data off the drive first.

You can use a live CD/USB stick to boot your desired flavour of Ubuntu (I recommend just using plain Ubuntu). To make a USB key, follow the guides that you can find here (look for the links explaining how to create a bootable USB stick in your OS, or just burn the ISO to a CD and boot from that).

Once in, open a terminal (from the applications menu or using Ctrl-Alt-T).

Next, you need to identify the drive you want to erase. If there is only one drive in the system, it doesn’t matter so much. But if you have multiple drives, you need to be extra careful to identify the right one. Go into Settings, and select Disks to see the disks you have installed:

Screenshot - 281214 - 23:16:55

The disk I want erased is highlighted here (in fact, I’ve already erased it, which is why its “Unknown”). Note down the “Device”, in my case it is /dev/sdc. If you just want to delete a partition, use sdc1 or sdc2 or whatever one it is you want deleted.

Ubuntu comes with a program called scrub. This is designed to overwrite drives with random data, multiple times, making it impossible for anybody to recover data from the drives, not even companies who specialise in data recovery. This is great for data safety, as your precious bank records can’t fall into the wrong hands. This will also work with USB drives.

Next in the console, you need to type the following command:

scrub -v /dev/sdc

Replace /dev/sdc with the disk/partition you want erased. This will overwrite the drive three times with random data. You can be sure nobody can recover data after the process has finished, but if you want to be doubly sure, add -n x after the -v flag in the command above, where x is the number of overwrites you want. Obviously, more overwrites is going to take longer, but will make the data even harder to recover. You might have to be a superuser, or “root”, to run the command; just add “sudo” to the very beginning of the line:

sudo scrub -v -n 30 /dev/sdc

When you hit enter, there’s no going back. Whilst its in process, you’ll get this screen:

Screenshot - 281214 - 23:11:59

Just wait for the process to complete and you’re done! You can throw the drive away (drill a hole in it to be even more certain), or re-purpose it for something else. Happy erasing!

My introduction into iOS land: Day 1
Bose SoundLink Mini Brief Overview

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.