TOPIC: DISK STORAGE
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.
A case of double vision?
4th November 2009One of the early signs that I noticed after upgrading my main PC to Ubuntu 9.10 was a warning regarding the health of one of my hard disks. While others have reported that this can be triggered by the least bit of roughness in a SMART profile, that's not how it was for me. The PATA disk that has hosted my Ubuntu installation since the move away from Windows had a few bad sectors but no adverse warning. It was a 320 GB Western Digital SATA drive that was raising alarm bells with its 200 bad sectors.
The conveyor of this news was Palimpsest (not sure how it got that name even when I read the Wikipedia entry) and that is part of the subject of this post. Some have been irritated by its disk health warnings, yet it's easy to make them go away by turning off Disk Notifications in the dialogue that going to System > Preferences > Startup Applications will bring up for you. To fire up Palimpsest itself, there's always the command line, but you'll find it at System > Administration > Disk Utility too.
My complaint about it is that I see the same hard drive listed in there more than once, and it takes some finding to separate the real entries from the "bogus" ones. Whether this is because Ubuntu has seen my SATA drives with SIL RAID mappings (for the record, I have no array set up) or not is an open question, but it's one that needs continued investigation and I already have had a go with the dmraid
command.
Even GParted shows both the original /dev/sd*
type addressing and the /dev/mapper/sil_*
equivalent, with the latter being the one with which you need to work (Ubuntu now lives on a partition on one of the SATA drives, which is how I noticed this). All in all, it looks less than tidy, so additional interrogation is in order, especially when I have no recollection of 9.04 doing anything of the sort.