Advanced

Secure Deletion of Data in Linux

Posted by linuxaria on · 5 comments
linuxaria.com; By Linuxaria
Mail this story
Print this story

I think that every user that has some skill know that a simple rm of a file or deleting it via any file manager is not enough to really remove it from your hard disk.

In Linux there are some tools that can offer you way more secure to really delete your files: DBAN if you need to erase completely a hard disk o partition or if you just have to delete some files you can use Shred or Wipe

Full Story

  Nav
» Read more about: Story Type: Tutorial

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments (5)

those are some fancy programs/commands for something really dead simple.

why not use "dd if=/dev/zero of=/home/user/myfile.txt"
Some of them rewrite the space over and over to avoid forensic reconstruction of the data... Your example might not be thorough enough for a high security environment.
Indeed, if the file is on an SSD, different pages may be assigned to the written 0s rather than rewriting the old pages due to wear leveling.

In this case, it may well be insufficient to destroy the data.

It's amazing what can be recovered using forensic techniques where disk pages have been rewritten even a number of times. The whole subject blows my mind.
When spinning platters are the medium, and you just want to clear the old data in the unused space:

1. Get root.

2. Go to a directory on the volume you want to scrub. Any directory will suffice.

3. Issue the following command:
dd if=/dev/zero of=zeros bs=1048576
This will fill up the volume with a zero file. (If you aren't root, you'll get only ~95% of the volume.)

4. Then issue this command:
shred -vu zeros
This will wipe the formerly unused space, then release it once again for new files. Voila!

Unless the volume is already over 90% used, the journal isn't going to be a concern. It may slow things down, but it will be forced to commit writes to the dnodes long before write coalescing becomes an issue.
Yeah, secure delete is tricky. http://arstechnica.com/security/2012/06/personal-data-put-at...

Quoting:why not use "dd if=/dev/zero of=/home/user/myfile.txt"


Won't work on a copy-on-write filesystem like btrfs. It probably won't work on any modern filesystem, even if it usually does in-place writes.

For SSD's it *may* be enough if your filesystem supports discard (the famed TRIM command in ATA land) and you just remove the file (and it's not present in any snapshots). But I would not bet on it.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post