How To Securely Destroy/Wipe Data On Hard Drives With shred

Sometimes you need to destroy or wipe data from hard drives (for example, before you sell your old hard drives on eBay) so that nobody else can access them

shred can be used to wipe files and also partitions and hard drives. If you take a look at shred’s man page…

man shred

 

2 Using shred

If you want to wipe your system partition, you must boot into a live system (such as Knoppix, the Ubuntu Live-CD, your hoster’s rescue system, etc.). This is not needed if you don’t want to wipe your system partition.

shred should already be installed (you can check with

which shred

); if it isn’t you can install it as follows (Debian/Ubuntu/Knoppix):

apt-get install coreutils

As I said before, I want to use shred on partitions and hard drives. So, for example, to wipe the partition /dev/sda5, you can use

shred -vfz -n 10 /dev/sda5

-v: show progress

-f: change permissions to allow writing if necessary

-z: add a final overwrite with zeros to hide shredding

-n: overwrite N times instead of the default (3)

So this would overwrite /dev/sda5 ten times.

You can also use shred for RAID partitions, e.g.

shred -vfz -n 10 /dev/md1

And to wipe a full hard drive like /dev/sda, you can use

shred -vfz -n 10 /dev/sda

Please note that shred can take a long time, depending on the size of your partitions/hard drives and the number of runs (-n).