Thu 28 Jul 2005
so i have all these old boxes lying around at work that I want to
shove off to the computer graveyard, but the drives need to be wiped.
Knoppix to the rescue!
The first thing I tried was
dd if=/dev/zero of=/dev/hda
After a few seconds, it exited, giving me an error. I thought I must
have done something wrong, until I realized the error was basically
telling me the input was 51385 sectors and the output was only 51384.
Then I realize the drive is only 51384 sectors, so it gets to the end
and has no place to write the next zero, so it exits with an error. It
exits cleanly when you use
dd if=/dev/zero of=/dev/hda count=51384
or (after getting the geometry with fdisk)
dd if=/dev/zero of=/dev/hda bs=512 count=(whatever the number is, I
don’t remember)
Another way to use dd is to use if=/dev/urandom to write random data
to /dev/hda. That got me thinking about a gnu program I read about
once called shred. It’s part of the file utilities package. The
command
shred -vz /dev/hda
writes random date 25 times by default. You can change that number
with another switch. The v puts it in verbose mode so you can see how
far along it is, and the z writes zeros on the final pass, to obscure
the fact that you shredded the drive. I made a little batchfile to
shred 8 gig drive I was working on, then print the date and time when
it finishes. It’s been going about an hour and it’s on its fifth pass.
