How to: Erase Hard Drives at Linux Command Line
The simplest way is the dd command. Simply type:
dd if=/dev/zero of=/dev/
This process takes a while but it will write zeros to the whole hard drive. The DD command can also be used to write zeros to just one partition, and should work on just about any Unix or Unix like system. But this may not be the end all and you’ll want a bit more security. Luckily several utilities exist for just such an occasion.
Wipe is one of the better ones I’ve seen. It claims to use the Gutmann method as one of it’s processes.
Another method is one of the simplest and makes reading man pages profitable. The good old rm command with -P does a three time wipe on each file, by (according to the man page) writing “first with the byte pattern 0xff, then 0x00, and then 0xff again.
Secure rm or “srm” is a fancy remove program that overwrites the files it deletes much like rm -P command. By default it overwrites, renames, then truncates the file(s) before unlinking and removing them. Two flags can be specified for the really paranoid, -m does “overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random)” and -z which zeros the files after overwriting. So srm -rf -m -z /dev/<drive name>/ would do a pretty good job of killing everything on the hard drive.
Another trick I picked up from the FreeBSD mailing list is: split -b 200m /dev/random randomdata ; sync && rm randomdata* This uses part of my preferred method of splitting the hard drive into multiple partitions then writing random data over each piece. If can be ran as many times as needed and by changing the -b flag’s size could make most data very unreadable.
And last but not least, Techrepublic has a post about using Shred to delete files and filesystems.