Should We Abolish User Access to rm? (2011)
linux-mag.com
linux-mag.com
The simplest implementation fell out of NetApp snapshots, but the next best thing was converting rm to essentially run a directory repostitory (at the time sccs but more modern ones would no doubt use git or something) and each 'rm' was a commit, push followed by removal of the file.
Running it on a live system (in the 90's) it slowed the build way down (removing old object files in 'make clean') but it gave us a way to recreate any state from scratch :-).
In BOFH mode you say "Gee that sucks, next time don't delete files you want to keep."
Here's a page explaining the "entomb" system they had.
A file system might implement `rm` so that it does not lose data outright, but keeps a few recently deleted files intact for undeletion. I suppose every journaling FS already includes everything necessary for it. E.g. http://extundelete.sourceforge.net/ uses ext3/ext4 journals. AFAICT NTFS undelete works the same way.
Some file systems have explicit snapshots and other tools that facilitate rolling back changes: xfs, ext3, ext4 all support snapshotting on Linux when run under LVM. It's even better than undelete.
Depends. Ext seems to use a F̶I̶F̶O̶ LIFO for the empty block list. It can make recovering data more tricky.
Last time I tried to recover some deleted data, it was about an hour after the delete took place. The recently deleted blocks were the first over-written by normal background tasks and everything I wanted to save was gone.
Every file more than a few hours old was easily recovered, right back to projects I had deleted a year previously.
edit: Thanks.
Experienced *nix users often work from an ordinary user account and turn to "sudo" only for special cases so they don't accidentally mess things up. When you use "sudo", you know you have to slow down and be careful. So why isn't an undoable file delete function not the default file deletion command, with rm reserved for special cases where you slow down and make extra sure you really want an irreversible delete?
Automated scripts would use rm as always, but for interactive work, especially on client machines with giant disks such as the typical general purpose user computer these days, there should be a different standard command for deletion that everyone learns long before they learn about rm.
(Anyone ever gotten too used to shift-Delete in Windows? Yeah...)
Instead, automate backups or file system snapshots.
I think GMail has this right: instead of a confirmation, it does what you asked for, and has an obvious non-modal undo button. Also, because I know things in the trash will be discarded after 30 days, I don't feel any pressure to 'really delete' them myself.
Then, if it was in the backups, the short-term problem is solved, and maybe the experience will scare them into being a bit more careful in the future.
If it wasn't in the backups, the most likely reason would seem to me be that it was created since the last backup (not that I'd know, IANA sysadmin), in which case there wasn't a ridiculous amount of work lost - maybe the experience will make them a bit more careful in the future.
Of course, the above doesn't apply with the sort of user who thinks IT is magic and can do anything, but if they're using rm, you've got bigger problems.
Also, personal opinion, but I hate automatic trash folders - rm is supposed to delete stuff. If I want a recycle bin, I'm happy to mv to a folder I created for the purpose.
Well-intentioned developers add a bit here and tad there and pretty soon you have 400% of what you need to perform your daily tasks to protect yourself from 0.001% occurrences. Which is actually ironic because I remember DHH stating that he was vehemently opposed to type-casting. Anyway, I think it is best to leave it up to end-users to build their own solutions and plug-ins for desired functionality but to leave these types of catch-all's out of the core product.
I wonder if the problem is not cultural or if there just isn't a technical solution we can agree on. mindslight mentioned wipe(1), but i don't think it's aligned with the same goal in mind, and it seems to be tied down with many complications (http://wipe.sourceforge.net/).
I guess the basic question is- should users be entrusted to permanently delete anything? rm is probably my third or fourth most-used commands because it is so fast and easy. It does exactly what it should- get rid of shit you don't need anymore, and very quickly. For example, I use templates to generate web applications and when I test new templates I will frequently want to get rid of the auto-generated one I just created. Without rm this would be an incredible pain in the ass or at least take more time and storage than it should. I like keeping the core strictly utilitarian and leaving the layers of safety to be built by bureaucracies after it has shipped.
But seriously, I don't see an issue here. There are backups for a reason. If it takes too much time to go through the bureaucracy of requesting backed up data, that sounds like the problem that needs to be fixed, not the existence of the "rm" command. And if the delay is there on purpose, it sounds like everything is going according to plan. What's the problem?
It took us a long time to accept the best of all possible worlds, GUIs more most people, and genuine, expressive shells, for a few.
For those few, rm is not a problem, no. In fact, it's a reminder that this isn't Kansas anymore.
You can later implement another in company program to perform the actual deletion, with strict warnings, which can execute the real rm command with the appropriate group permissions. Ideally, this should at least deter users from blanket deletion of their file systems, though eventually some will come to abuse the true deletion program, believing they know better than IT. However, this is largely inevitable, and some users will always behave that way, so you need to consider this when discussing any technical measures taken towards something like rm.