HOWTO securely Erase whole harddrives

From LinuxReviews
Jump to navigationJump to search

If you need to replace a computer then you probably want to make sure the information on the hard-drive is securely erased before you deliver it to your local recycling facility.

Using dd[edit | edit source]

dd (manual) is a handy tool used for making copies. It can also be used to quite securely wipe harddrives:

File: ddwipe.sh
for (( i = 0;i<10;i++ )); do
    dd if=/dev/random of=dev/hda && dd if=dev/zero of=/dev/hda
   done

This will overwrite your entire hard drive (in this case seen as hda by Linux) with random information ten times.

Thanks to Ritter and EnIgMa on linux-noob EFNet

Using shred[edit | edit source]

shred (manual) is a tool designed to "overwrite a file to hide its contents, and optionally delete it". GNU/Linux considers block devices to be files, so you can also use it to wipe entire harddrives with a command like this:

shred -zn10 /dev/sda

The -n option tells shred how many times it should overwrite the harddrive. You may increase this number depending on time and paranoia. The -z option tells shred to overwrite with zeros to hide the shredding after it is done.

Thanks to Walt R.