Blanking a hard drive
Sometimes it is necessary to perform a low-level format on a hard drive, so that the information stored on it cannot be recovered. For example, you might be selling an old drive on ebay, and don't want your personal files or data such as passwords to be readable.
With dd
dd can do this by writing ones and zeros to the drive the lowest level. The following will certainly be enough
This process is by design irreversable, and should not be done unless you are really absolutely sure.
$ # fill drive with all zeroes $ dd if=/dev/zero of=/dev/sda
Remember to change /dev/sda to the appropiate drive or partition!
Because dd can be used to write any data, you are not limited to random bits or zeros. Anything can be piped to dd and it will write it. So if you find that kind of thing funny you might write "LinuxQuestions.org forever!" a few billion times across the drive. Please note however that this is completely pointless and may be slower than just zeroing the drive.
$ yes "LinuxQuestions.org forever!" | dd of=/dev/sda
Random Data and Multiple Passes
Do not waste your time with random data or multiple passes.
/dev/urandom tries really hard to produce really good random numbers, and as a result it is really slow (no more than 8MB/s throughput even on modern machines). Blanking modern >=1TB drives will takes ages with this method. Unfortunately the kernel does by default not offer a source for fast random numbers, so if you must have random numbers instead of zeroes (paranoia!) you will have to use something other than dd, something that comes with its own cheap and fast random number generator.
In case of hard disk errors, sectors that can't be written to because they're damaged may still contain data that can be read by a data rescue company. Similar issues can occur when the drive is limited to a lower capacity than normal with a 128GB jumper - if there is data beyond the 128GB, simply removing the jumper can make it available, because you never overwrote that data in the first place.
External Links
- There is an excellent Linux-based boot disk that does this automatically, Darik's Boot And Nuke, or DBAN for short.
- dban.sourceforge.net (dban.sourceforge.net)