I occasionally need to wipe a hard drive and give it to someone else. When I do, I’m always careful to make sure that I have wiped it clean. Of course, wiping a hard drive clean is a bit more complicated than just deleting everything or even reformatting it. If you really want to make sure your hard drive is wiped clean, you need to over write it with random data, multiple times.
On Linux, there is a built in program that provides this service – dd. It’s done from the command line, so it requires using a terminal. But it’s a fast, effective, useful utility.
First step, make sure you have two additional pieces of software installed (in addition to dd that is): pv and dialog. So, from the terminal (I’m using Kubuntu; adjust accordingly), type:
sudo apt-get install pv dialog
Once those two pieces of software are installed, make sure you have your drive connected to your computer. You’ll then need to find out what designator your system has assigned to your hard drive. This can also be done quickly from the command line. Simply type:
This will tell you what disks are connected to your computer and provide a bunch of information about those disks. Based on that information, you should be able to determine what designator your target hard drive is (e.g., dev/sda, dev/sdb, dev/sdc, etc.). Once you figure it out, you’re now ready to run dd on it. But make sure you know precisely which drive it is as you really don’t want to wipe a drive unless it’s the correct one.
In order to wipe the drive by overwriting random data, you would type the following at the terminal:
sudo dd if=/dev/urandom of=/dev/sdX
where X is the letter of the target drive. This is the basic dd command. But to speed things along, you’ll want to add bs=1M at the end, as this will write in larger sectors. And if you want to see the progress of the write, you need to add “| pv |” in between the input and output operations. So, the faster command with a completion bar would be:
sudo dd if=/dev/urandom | pv | sudo of=/dev/sdX b=1M
Again, where X is the letter of the target drive. The inclusion of “pv” is basically like a “verbose” command, allowing you to see the progress of dd as it writes random data over your drive.
I used information from these sources for this post:
6,579 total views, 3 views today