How to wipe a disk in LinuxPosted: August 20, 2012
Imagine, you have a hard disk drive and want to give it away, sell it or return it to vendor. But you have some sensitive data on it, so you better clean the disk up before doing so, so that nobody ever can recover any data from the disk.
It is very easy to do this in Linux. You even do not need any special tools for that. Just use the standard dd utility to fill the disk up with either random data or zeroes.
Below is an example of wiping whole of an external USB disk, destroying MBR, FAT etc.
Option 1: Use random data to overwrite all of the disk contents.
dd if=/dev/urandom of=/dev/sdb bs=1M
Option 2: Use zeroes to overwrite all of the disk contents.
dd if=/dev/zero of=/dev/sdb bs=1M
Note 1: If you would like to wipe only a partition instead of the whole disk, you would say, for example, /dev/sdb1 instead of the /dev/sdb.
Note 2: Using random data theoretically gives you better degree of protection than using zeroes, though some argue that in real life it is irrelevant and for practical purposes both methods are equally good. Please note, that using random data is considerably slower than using zeroes. It took me a bit more than 2 days to wipe 1 TB USB disk using random numbers, and a bit less than 1 day to do the same with zeroes.