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!
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.
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.
Today we'll cover one way to enable or disable your network interface in the Linux…
Today's exercise is a nice and simple exercise where we check your NIC speed in…
Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…
I think I've covered this before with the ls command but this time we'll count…
Today we'll be learning about a basic Linux command that's known as 'uname' and it…
If you've used hardinfo in the past, it may interest you to know that hardinfo…