Live data from Hacker News

Rm does not permanently delete files

medium.com

21–30 of 55 posts

Re: Rm does not permanently delete files

#21

Author himself stated that rm has a -P flag, that actually does the same thing more correctly and more securely: >Files are overwritten three times, first with the byte pattern 0xff, then 0x00, and then 0xff again, before they are deleted. Plus the -P flag is available on both GNU and BSD versions of rm. Somehow I fail to see the user-friendliness factor. Edit: formatting

That actually seems to be a BSD extension not supported by GNU coreutils/fileutils.

Re: Rm does not permanently delete files

#22
The old hard-drive lore was that files may still be recoverable until the contents have been written 7 times - and the government had tools that could recover previously overwritten data.

Is this still true with SSDs?

Re: Rm does not permanently delete files

#23
post #5

This is the type of program that should be written in C, not in Javascript with 9 different dependencies...

True. But no harm in getting it off the ground quickly before optimising. Git was written in Perl originally, and ported bit by bit to C. I think this shows it can be a good way to work -- prototype quickly, then optimise.

This. You can bicker all day long about the "correct" language to write something in but at the end of that long day of going back and forth nothing actually got written. Better to go with what you know and prototype then weigh the benefits of rewriting/refactoring it in another language/toolchain.

Re: Rm does not permanently delete files

#24
post #17

When using the terminal command rm (or DEL on Windows), files are not actually removed. Yes they are. As a user, I see a file, type rm file, then it is gone. The file has been removed. Yes those parts of that file are possibly recoverable back into the original file, even without much work, but the file has been removed.

The file, yes, but not the file contents. Worst of all, if you opened the file recently with any process, there is a pretty good chance that the file-descriptor can be found in:

  /proc/
somewhere.

And with that in mind you can use a combination of lsof, grep, sed or any other tool to still read the file as it was.

Re: Rm does not permanently delete files

#25
post #22

The old hard-drive lore was that files may still be recoverable until the contents have been written 7 times - and the government had tools that could recover previously overwritten data. Is this still true with SSDs?

Unlikely, because while hard drives use magnetic storage (where a few magnetic domains may still point in the direction of the previous magnetization, SSDs store bits in discrete logic gates - meaning that even if there is a trace, the chip would need to be disassembled and the gates examined with an electron microscope one-at-a-time. Furthermore, it's less likely that data can survive a single rewrite, given the mechanism used (instead of bytes being changed in-place, whole blocks are erased completely and then re-written - which means the erasing is less delicate because it doesn't need to avoid flipping neighboring bits).

Re: Rm does not permanently delete files

#27
post #5

This is the type of program that should be written in C, not in Javascript with 9 different dependencies...

True. But no harm in getting it off the ground quickly before optimising. Git was written in Perl originally, and ported bit by bit to C. I think this shows it can be a good way to work -- prototype quickly, then optimise.

As pointed out elsewhere, this functionality already exists in Unix userland tools, like `rm -P` or (for GNU) `shred`.

Re: Rm does not permanently delete files

#28
Neat idea, but defaulting to recursive force mode (-rf) is frankly a bit scary (and irresponsible). A great way to accidentally shoot your own foot off after you've put it through a meat grinder.

I pity the fool that tries to use this programmatically with a unset or null var, eg.

  skrub /$imfucked

Re: Rm does not permanently delete files

#29

Earlier quoted context omitted.

True. But no harm in getting it off the ground quickly before optimising. Git was written in Perl originally, and ported bit by bit to C. I think this shows it can be a good way to work -- prototype quickly, then optimise.

This. You can bicker all day long about the "correct" language to write something in but at the end of that long day of going back and forth nothing actually got written. Better to go with what you know and prototype then weigh the benefits of rewriting/refactoring it in another language/toolchain.

Except, of course, when it is already written and people are just ignorant of tools that have been around for many many years.

Re: Rm does not permanently delete files

#30
post #22

The old hard-drive lore was that files may still be recoverable until the contents have been written 7 times - and the government had tools that could recover previously overwritten data. Is this still true with SSDs?

> and the government had tools that could recover previously overwritten data.

That wasn't true. But, since we can't prove it's not true precaution says you should over-write drives a few times with pseudo random data.

SSDs are a bit more worrying because end users don't have full control.

But with physical drives or SSDs if the data is that important you should be looking at physical destruction, rather than just over writing.

Post reply on HN