Security

Let’s Shred A Partition

In today’s article, we’re going to shred a partition. What does that mean? It means we’re going to erase the data in a manner that makes it difficult for that data to be recovered. Notice that I didn’t say ‘impossible’? That’s because they’ve got some pretty sweet forensic tools out there and who knows what they can recover.

This will keep your deleted data safe from a common thief or dumpster diver. It’s also not a bad idea to just destroy the drive, perhaps after shredding it, just to be sure. If you’re the enemy of a powerful government, you probably shouldn’t keep data on hard drives unless you’ve secured them very well! This may not help those sorts of people.

The tool we’ll be using is actually called ‘shred’. It’s possibly installed by default, but it’ll be in your default repositories. The command defines itself as:

shred – overwrite a file to hide its contents, and optionally delete it

It further describes itself as:

Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data.

This is actually a pretty easy article and won’t take much time to go over. There’s just a couple of commands I wanted to cover, and we’ll  just showing you how to shred a partition. So, ‘snot all that complicated, nor all that involved. On with the show!

Shred A Partition:

Like many other articles on this site, we’re gonna need an open terminal. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

First, let’s make sure you have shred installed. Enter this command:

shred --version

If you don’t have shred installed, you’ll need to install it using your package manager. If you are using apt, then it’d look like:

sudo apt install shred

Once installed, you need to know which partition you want to shred. For that, you’ll possibly need the following:

lsblk

Once you have identified the partition, such as ‘sdb2’, you can shred the partition. To do that, try this command:

sudo shred -v /dev/<partition>

We use the -v for verbose, so it shows us the progress. This command will do the default. It will overwrite the partition three times. You can change that value easily enough. To do so, use a command similar to:

sudo shred -v -n 10 /dev/<partition>

The -n lets you pick the number of times it will shred the partition, that is overwrite it with data, and you can pick any number you want. So, change the ’10’ to whatever you want, but be aware that it can take quite a while.

That’s it, really. There’s more that you can do with shred, so check the man page. I’m only covering how to shred a partition in this article.

Closure:

There you have it, another article. This one tells you how to shred a partition. If that’s something you need to do, you now know how to do it. As I mentioned in the first section of this article, it’s not very complicated. It will take some time, so be sure to use the -v option and keep track of what’s going on.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

1 day ago

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

3 days ago

Save A Command’s Output To A File (While Showing It In The Terminal)

The title is the best I can come up with to describe this exercise as…

5 days ago

Demystifying journalctl: A Comprehensive Guide to Linux System Logging

It was suggested that I write an article about journalctl, which seemed like a large…

1 week ago

Extract Text From Multiple File Types

Today we will have a fairly simple exercise as we're going to just use a…

1 week ago

Meta: I’ve Been At This For Three Years!

I have not done a meta article lately. I don't find them interesting to write…

2 weeks ago