Skip to content


How to securely clean up data on a hard disk on Linux

Linux Security

When people throw away important documents they usually use a shredder to make sure that these documents can’t be read by unauthorized people. Similarly companies run a shredding process on computers before either discarding or donating them. This is a good practice even for individuals. You don’t want someone getting hold of your personal data such as photographs, emails, bank documents, etc. Let’s look at how you too can clean up a hard drive before junking it or giving it away.

We’ll use the Linux program shred for this. Shred is a tool that usually ships out of the box with most Linux distributions. If you don’t have it installed just use your Linux distribution’s package manager to to get it. Shred is a pretty useful tool. It can be used to securely delete individual files or even complete drives. Note that if you are trying to shred the hard drive on which your operating system is running you will need to use a Live CD distribution such as Knoppix or the Ubuntu Live CD for this.

Say you have a hard drive located at /dev/hda on your Linux computer and you want to shred it’s contents completely run the following command:

# shred -fzv -n 100 /dev/hda

Here’s the breakup of the command shown above. We’re asking the shred command to forcefully (-f) overwrite the disk with zeros (-z) and display the output in a verbose (-v) manner. We’re asking shred to overwrite the disk with the these zeros a hundred times (-n 100) over.

Checkout the shred command’s man page for more information on how to use it. There are a few other options shown there that you might find useful.

Posted in Linux, Security.

Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

 

You can always opt out of this email subscription at any time.

One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Articles Collection of May’09 « Dako-Tux linked to this post on June 24, 2009

    [...] How to securely clean up data on a hard disk on Linux [...]



Some HTML is OK

or, reply to this post via trackback.