March 11, 2004
Wipe that hard drive [ Software ]
Every so often, I need to wipe a hard drive and don't have a specific utility or procedure proscribed for the wiping. Then it's fun to whip out ye olde Knoppix boot CD and this shell script:
#!/bin/sh
for device in /dev/hda1 /dev/hda2 /dev/hdb1 /dev/hdb2; do
for pass in one two three four five; do
echo "Wiping ${device}, pass ${pass}"
dd if=/dev/zero of=${device} bs=32768
dd if=/dev/urandom of=${device} bs=32768
done
echo "${device} wiped ${pass} times."
done
echo "Done."
This takes a while, but you can generally kick this off in the evening before going home and come back in the next day to find the specified devices wiped clean. Tricky part is getting all the right devices - for example, on a Compaq Proliant 1600, the RAID controller shows up as /dev/ida with the logical drives enumerated as c0dX and their partitions as c0dXpY (similar to Solaris). Often a 'dmesg | grep [device]' will help track down the particular partitions you care about.
[Update 20040831] Or you could just use the 'wipe' utility, which works on block devices just as well as on files. A 'wipe -kq /dev/hdaX' should do the trick for a quickie wipeout.
Posted by edobbs at March 11, 2004 06:32 PM
Original content copyright ©1995-2006 Eric Dobbs, except where otherwise noted.
