TOPIC: DATA RECOVERY SOFTWARE
Wiping of hard drives with Linux
2nd December 2013More than a decade of computer upgrades can leave obsolete kit in your hands, while legislation on electronic waste disposal might leave you wondering how to get rid of it. Thankfully, I discovered that my local council refuse site, only a few miles away, accepts such items for recycling. It saw me several times last summer disposing of obsolete and non-working gadgets that had stayed with me too long. Some were as bulky as computer monitors and printers, while others were relatively small.
Disposing of non-working, obsolete equipment is an easy choice, but it's harder when a device still works and might be useful. Computer motherboards still include PS/2, floppy and IDE ports, making decisions trickier. My Gigabyte Z87-HD3 mainboard has one PS/2 port (compared to two on older boards), limited IDE sockets and surprisingly, a floppy drive socket, unexpected for anyone who considers these technologies outdated. PC technology isn't abandoning backwards compatibility yet, as this mainboard supports an Intel Core i5-4670K CPU and 24 GB of RAM.
Despite the IDE port, I wasn't tempted to use my leftover 10 GB and 20 GB hard drives that I've had for over a decade. Ten years ago, that capacity would have been respectable if not for our growing need for data storage due to photography, video and music. Beyond size limitations, these drives' speed can't compare with today's standards, which became obvious when I replaced a similarly aged Samsung 160 HD with a Samsung SSD.
This line of thought led me to recycle the drives, so I considered wiping them. Linux offers a good tool for this: the dd
command. It can overwrite disk data to make information virtually irretrievable. Linux also has several dummy devices that supply junk data for overwriting. These work like /dev/null
, which suppresses command output. The first is /dev/zero
, which supplies octal zeros, which I used. For those wanting more randomness in overwriting, there's also /dev/random and /dev/urandom
.
To overwrite data on a disk with zeroes while having feedback on progress, the following command achieves the required result:
sudo dd if=/dev/zero | pv | sudo dd of=/dev/sdd bs=16M
The operation needs root privileges. The if
parameter of dd
specifies the input data, which is sent to pv
that displays a progress bar not provided by dd
alone. The output then goes to another dd
command with the target disk specified by the of
parameter. The bs
parameter in the second dd
command sets the block size for writing. Note that pv
isn't installed by default. On Debian, Ubuntu or Linux Mint systems, install it with this command:
sudo apt-get install pv
The pv
sandwich is also invaluable when using dd
to copy partitions between different physical or virtual disks. Without it, you might wonder what's happening during silent operations, which is particularly concerning when retrying failed operations that take a long time to complete.