Undelete In Linux 697
Manuel Arriaga writes "[To the editors: I am not a professional programmer, nor will I ever be one. My income does not depend on my computing/programming skills, and hopefully it never will. So promoting free software I wrote does not help me in any financial way, no matter how indirect. libtrash is free software (GPL2), and I distribute it for free from my website. I have nothing to gain from the increased exposure, except for knowing that I am helping others. And I know slashdot isn't freshmeat... With that out of the way:]
I have seen this topic discussed in the LKML multiple times by now, and many more people asking in the newsgroups why "I can't recover my deleted file on GNU/Linux".
Here is my answer to that question. libtrash gives Linux a real "trash can". And it has been doing so (with varying degrees of stability) for more than one year now.
If you consider it appropriate, make this information public on slashdot."
See also... (Score:3, Informative)
PDHoss
Recycle Bins - don't you just hate them? (Score:4, Insightful)
I can't believe how many Windows users get caught out when they dual boot my machine into Windows (have to have it for the office because others use my workstation) and find I have disabled the Recycle bin. Haha, more fool them.
Disclaimer: take with a pinch of salt. If you have sodium issues, take with a pinch of Lo-Salt instead.
Re:Recycle Bins - don't you just hate them? (Score:2, Insightful)
Nice attitude.
Re:Recycle Bins - don't you just hate them? (Score:5, Insightful)
If we want joe-user to use linux, we need silly stuff like this.
For you and I (and those in the know), we know damn well that you can delete a JPEG without it affecting anything. And if we're in doubt about a file, we know to move it somewhere temporarily. If something breaks, move it back. It's not all that often that you'll be deleting system files (and even then, its usually configuration files).
Anyhow, I guess the reality is that a tool like this only needs to be useful to someone. If it is useful to a couple of people, then its worthy of its existence. It's not like it is a default application. Don't use it if you don't want it. That's the beauty of the Open Source world...you can do what you want.
No, I don't. (Score:5, Insightful)
Personally, I prefer to simply hit "delete" to move files to a preset temporary directory (which can also remember where those files originally were, and restore them with a couple of clicks) than to have to manually drag them to a directory I created.
If this kind of "commodity" seems pointless to you, then you probably program by writing machine code with a text editor.
RMN
~~~
Re:Recycle Bins - don't you just hate them? (Score:2)
Re:Recycle Bins - don't you just hate them? (Score:2)
Sort of -- you can't tell a windows system to delete files directly AND turn off delete confirmations at the same time. I find it more annoying for the system to ask me every time I delete a file, so I set the recycle bin for 1% of the drive and turn off confirmations. When you set the size to 0%, it immediately turns on confirmations.
(another annoying thing is that it is "precentage" of the drive rather than actual size -- even 1% of my hard disk is a couple of gigabytes, which is a total waste)
Re:Recycle Bins - don't you just hate them? (Score:3, Informative)
Re:Recycle Bins - don't you just hate them? (Score:2)
They go bye-bye real quick
But really, when I delete files, I WANT them gone. Period. People are using trash cans and recycling bins as an excuse not to do proper backups!
Re:Recycle Bins - don't you just hate them? (Score:2)
In linux you might do something like rm *a*b*c*.*
That command can delete anywhere from 0 to all of your files depending on how they are named. And if you accidentally type *a*f*c*.* you might delete the wrong thing. Doesn't happen in windows, unless you are using cygwin.
Re:Recycle Bins - don't you just hate them? (Score:2, Funny)
Altogether Now:
Don't Do That Then.
Someone has to keep the old jokes alive you know.
Re:Recycle Bins - don't you just hate them? (Score:5, Insightful)
>Because you have a poor machine with less than 4Gb of disk and you need all the space you can get
But still, no matter how long you've been a linux user it's still possible to accidently type "rm core *" rather than "rm core*" and not catch it until half a second after you hit enter and realize that you have irrecoverably destroyed your project(you didn't really want to punish it for segfaulting).
Re:Recycle Bins - don't you just hate them? (Score:3, Insightful)
I once typed `rm -r logs/old
that was a sucky weekend. (-:
S
Re:Recycle Bins - don't you just hate them? (Score:3, Insightful)
rm -rf
The problem with that was that '.*' included '..'
Before I realized what it was doing it had wiped out
Re:Recycle Bins - don't you just hate them? (Score:5, Insightful)
From: Other Smug Person
Subject: Recycle Bin
As you may be aware, you feel it necessary to disable a safeguard for your system. We're all aware that you're infallable, and subject to all the perks and benefits that come with that title. However, for the rest of us who realize that mistakes *do* happen...
In Windows, delete sends things to the recycle bin. Shift+Delete sends it away forever and ever.
If you're so worried about your disk, change the ammount of space the recycle bin can use, you shaved monkey!
It's partly the attitude of people like you that kills Linux's chances on the desktop. Some people need to use computers, but *don't* work in IT, okay?
Sincerely,
Other Smug Person
Re:Recycle Bins - don't you just hate them? (Score:3, Insightful)
Mistakes shouldn't be recoverable? I'll have you know that some of us aren't so adept at Linux that they don't make mistakes. I learned the hard way. Thanks to some newbiness on my part, and lack of a 'recycle bin' on Linux's part, I had to re-upload my entire website.
You can make fun of me if you like, but you're not going to hurt my feelings over it. Shit happens. A silly mistake shouldn't cost you anything. Anybody who knows anything about good UI design will tell you the same thing. It's fine if you want to turn off the 'recycle bin', I don't care. But to say "You don't need one" is kind of like saying "you don't need a backup parachute".
Recycle Bin vs Trash Can (Score:5, Funny)
The editorial cartoons of the time were great. One showed a picture of Jobs carrying a trashcan full of legal documents with someone commenting "At least the judge let you keep something to carry all that home in."
Grot! (Score:2)
I always did like the way the Brits commonly use the term "rubbish" for trash. It's got a classier sound to it.
Re:Recycle Bins - don't you just hate them? (Score:3, Informative)
why would you need that? (Score:3, Interesting)
Because it works on EVERY Linux app (nearly) (Score:3, Interesting)
Note that some apps (generally network services) don't like preloaded apps running in their environment. You can easily disable it for such cases, and most of the time you wouldn't want real trashcan support on, say, your mail serverr anyway
Check libtrash out people - seriously, it rocks. I'm glad the project is getting the exposure it deserves.
Closer and closer. (Score:3, Informative)
But, this issue was discussed in a recent Ask Slashdot. I posted this comment [slashdot.org], regarging Novell's Salvage utility. A true file system level undelete utility such as this would be FANTASTIC. Is it possible to adapt libtrash to accomplish this?
Re:Closer and closer. (Score:2, Informative)
No! It works good! (Score:5, Informative)
For a while I tried a bash utility for it...boy was that a bad idea - it wouldn't let me delete files with spaces in the names, and occasionally it would totally wig out when given certian input. So I switched to libtrash.
In answer to your comment, I want you to think about that. What you're suggesting, basically, is that the system works exclusively on local filesystems, which means that it is specifically programmed NOT to interact with the file system itself, but rather with the drivers for local devices. Seems rather far-fetched, don't you think? It works fine on anything you've got mounted.
Here's how it works: it remaps the glibc function unlink() to move files to a new directory - that being different for each user and dependand upon environment variables (mines called ~/.trash). Certain directories can be marked as "you can't delete from here." ~/.trash, for example, is one of these directories. There is also an included script to keep the ~/.trash directory below a certian size (I put this script in my cron.hourly).
There are currently two downsides:
1) The rule that the cleaning utility uses isn't very good right now. It picks the biggest over the oldest files to delete (at least, that's what it used to do - not really a big change so maybe someone's fixed it by now).
2) Using it as root can be disasterous during boot-up. Starting it at EXACTLY the right time after boot-up is difficult, and the only way I've heard of doing it is to replace the root's profile file after booting, which is a definite risk, because if the power cuts out and you still have that profile in place, the machine probably won't boot (mine wouldn't).
NOOOO!!!! (Score:4, Funny)
fuck it, hey, boss, if this patch becomes mainstream, can we move to solaris?
linux on the desktop (Score:4, Funny)
[x] Trashcan support
[ ] Easy to use Windowing system
[ ] Standard software install system
[ ] Easy to use Windows filesharing
[ ] Easy support for video files and DVD
[ ] Desktop company support
Way to go LINUX!
I know you're kidding, but.... (Score:4, Insightful)
[X] Easy to use Windowing system - KDE
[X] Standard software install system - LSB, Red Hat, Mandrake, Suse
[X] Easy to use Windows filesharing - KDE, Samba
[ ] Easy support for video files and DVD - No answer
[X] Desktop company support - Red Hat, The Kompany
Re:I know you're kidding, but.... (Score:2)
Re:I know you're kidding, but.... (Score:5, Informative)
I've installed mplayer on two SuSE 8.0 linux machines, and it's amazing. You can see DVD's, AVI's and even look at at microsoft media streams.
e.g. 'mplayer mms://streaming.omroepbrabant.nl/live1'
And how easy do you want it? You can easily make an icon on the desktop that starts mplayer on the dvd currently in the drive.
So, visit www.mplayerhq.hu and rejoice.
Re:I know you're kidding, but.... (Score:2)
Libraries, different configuration options (configure --with-gui), and configuration files...
I use it daily, I love it, but I don't think most "everyday users" would think it was easy.
Re:I know you're kidding, but.... (Score:4, Insightful)
Um, KDE is really nice and my windowing system/manager of choice under Linux. But it's really not so "easy to use" "all the time" to the degree that Windows and Mac OS are.
[X] Standard software install system - LSB, Red Hat, Mandrake, Suse
By listing four things here, you've gone right ahead and said that the software install system is _not_ standard. There is a very different user experience for each distribution's install, enough to make the average user think he is installing a different OS for each one. I know my mom thinks Red Hat is an OS.
[X] Easy to use Windows filesharing - KDE, Samba
I can't say Samba is easy to use Windows filesharing. Easy to use Windows filesharing is clicking on a button that says share files and seeing that folder show up in Network Neighborhood. It's not SWAT.
Re:I know you're kidding, but.... (Score:3, Insightful)
Then what OS would you recommend that *does* have a standard software installation mechanism? Windows certainly doesn't count - I've used three entirely different installer applications just today...
Re:I know you're kidding, but.... (Score:3, Informative)
By listing four things here, you've gone right ahead and said that the software install system is _not_ standard.
I think what the poster meant was that Red Hat, Mandrake and Suse all conform to the Linux Standards Base. Which defines the standard packaging (software install and maintenance) system for Linux. Of course, you can pick your own front end.
"[X] Easy to use Windows filesharing - KDE, Samba"
Easy to use Windows filesharing is clicking on a button that says share files and seeing that folder show up in Network Neighborhood. It's not SWAT
Damn stright, I agree. But KDE does have this ability - look for ksambakonquiplugin (shit name I know) on apps.kde.com. Its too bad the distros don't ship with it turned on by default.
Re:I know you're kidding, but.... (Score:3, Interesting)
For the purpose of this complaint, your mom is basically right. Microsoft doesn't make a package management system that works on multiple corporations distributions of the OS, so why should Red Hat. Just pretend Red Hat is an OS and your complaint goes away. Just because both kernels are signed "Torvalds" doesn't mean their the same OS. Heck, Red Hat even changes the kernel anyway.
I can't say Samba is easy to use Windows filesharing. Easy to use Windows filesharing is clicking on a button that says share files and seeing that folder show up in Network Neighborhood. It's not SWAT.
Maybe your describing Mac OS X Windows file sharing, because it's not that easy on any Microsoft OS. Sure, that's all that you're supposed to have to do. But have the time it doesn't work. "Okay, enter this name and password to get my files." "uh--it's just asking me for a password, no name." That's if you can somehow magically get the computers to see each other.
You can come back and say "you must have done it wrong, TRACK-YOUR-POSITION", but if there was anything for me to screw up, that just proves it's not as easy as you claim it is.
Re:I know you're kidding, but.... (Score:3, Informative)
> says share files and seeing that folder show up in Network
> Neighborhood.
Like one can do in Konqueror-3.1 (and in Mandrake-9.0's Konqueror) ?
Yes, that box can get a checkmark now.
David.
Re:I know you're kidding, but.... (Score:4, Funny)
You mean GNOME, right?
Re:I know you're kidding, but.... (Score:2)
[x] Easy support for video files and DVD
You could do a LOT worse than mplayer [mplayerhq.hu]..
Re:I know you're kidding, but.... (Score:2)
Take a look at http://videolan.org/ [videolan.org]'s client. Easiest DVD player I've worked with...
From the site,
Re:linux on the desktop (Score:2)
I think that having totem set up by default on linux desktops would go far to dispel the 'no good media player on linux' myth...
Where's your sense of danger??? (Score:5, Funny)
Really? (Score:2)
Maybe you ought to take a stress pill and thing things over.
...a GOOD thing. (Score:5, Insightful)
That being said, though, I think it's a great idea. It would be a tremendous fail-safe to those just beginning to learn the survival commands (more specifically, rm).
Plus, to all you old folks out there flipping me the eBird right now...I'll bet 70% of you (yet another made up statistic) have accidentally lost something by using rm without realizing which directory you were in. Happens to all of us. Wouldn't "sifting through the trash" be so much easier than looking throught yesterday's tape backup?
Well, maybe the tape is penance for screwing up the rm.
How often do you really need undelete? (Score:2)
I'm part of a team that runs our network. Specifically, we have two samba servers that store close to 70GB of files for over 60 users. The users cover both ends of the computer literate spectrum. On average I restore a file from tape less than once a month.
If you feel this type of thing is needed make sure it's an option that can be turned off.
Re:How often do you really need undelete? (Score:3, Interesting)
Not very often. But when I do need it, it's an emergency. In DOS/Windows, even if I deleted for real (not just trashcanned the file) I can bail out of Windows, go to DOS, and use Norton Undelete to recover the file(s) in seconds.
The lack of an undelete does makes me leery of *NIX as a work platform, because dumb typing mistakes DO happen, bad aim with the mouse DOES happen, and most common of all, brain cramps happen. These deleted-file errors are all quickly recoverable in DOS/Windows, without needing to know how good or recent your backups are (got a backup of that project you JUST finished??) let alone root thru them.
Anyone got a technical explanation of why *NIX doesn't have a true undelete? this fellow's trashcan is a good start, but we've all emptied the trash by habit or reflex when we didn't really want to...
Re:How often do you really need undelete? (Score:4, Insightful)
The trick is that once an entry has been marked, it, and the sectors on the disk the file uses can be used by a different file. So the longer you wait, the less likely you'll be able to recover the file.
There's no undelete for Linux or UNIX because none of the filesystems support that feature, AFAIK. Also note that Microsoft's NTFS doesn't support that feature either. It's probably just too hard to integrate with everything else (like journaling) they've put in the FS. Personally, I'd like to see undelete put back into the FS layer (that's where it belongs, not the trashcan hack that everyone peddles). What would be really neat would be versioning (like a CVS filesystem) so I could revert to an earlier version of my file. This wouldn't necessiarly take more space since the FS could overwrite older data as it needed to (the older versions/delete files would appear to be free space).
Re:...a GOOD thing. (Score:5, Informative)
Put this in your ~/.bashrc and type 'source ~/.bashrc'.
I'm sure somebody can improve upon this by adding more checks, but basic functionality is there.
function rm () {
if [ $# -gt 0 ]; then
if [ ! -e ~/Trash ]; then
mkdir ~/Trash
fi
mv $@ ~/Trash
fi
}
TODO:
- set file permissions for trash can
- check that the files can be removed before moving them
- make sure you have a trashcan for each parition and move files to the trash on the same harddrive when removing them
- finish the TODO
Re:...a GOOD thing. (Score:4, Funny)
- Allow actual deletes. How do you empty the Trash can? mv -r *
ext2 filesystem already has undelete attributes (Score:3, Informative)
Take a look at the man page for chattr and lsattr. Making a file undeletable has been on the table for a long time.
But, like most other projects out there, it got to version 0.0.2-beta3-pre4 and stalled.
some linux undelete urls (Score:4, Informative)
http://www.praeclarus.demon.co.uk/tech/e2-undel
http://chandra.ph1.uni-koeln.de/linux/HOWTO/min
http://lde.sourceforge.n
http://recover.sourceforge.net/
h
http://www.securi
Oh my. (Score:2, Insightful)
So everyone is perfect? (Score:5, Insightful)
Sure, some people use it as temporary folder, but so what? There will always be people who use things other then the way they are intended. If it works for them, so what? If it is so painful for you to contemplate, don't look at it.
Re:So everyone is perfect? (Score:4, Insightful)
rm means 'remove'. Not 'move to trash'. Think of it as the 'empty trashcan' command. Would you like a trashcan that moves things to yet another trashcan when you empty it?
If you're uncertain about wether or not to remove something dont use rm. You're entirely free to rm
And if you, despite knowing that rm means 'remove', make a mistake, just restore from your backups.
Re:So everyone is perfect? (Score:5, Funny)
Well, that is--more or less--the way that actual trashcans operate
bacchusrx.
README? (Score:3, Insightful)
Why is there no README or any other info on your site about this thing? I want to know how it works and how it is different from alias rm='mv ~/.trash', or the KDE trashcan, before I download it. Man I hate sites like this that expect you do download the package, then untar it, just to read a README file. How hard is it to throw it on your website with a link?
Linux Undelete Project (Score:2, Informative)
metacommentary! (Score:2, Insightful)
As a point of note, those of you complaining about the disclaimer in the article should realize that, if the disclaimer hadn't been there, you would be complaining about how "/. isn't an advertising service, you Window$ Idiot!!111!11!!!11!!"
Sheesh.
Not a solution (Score:5, Insightful)
Clearly users appear to want to be able to correct mistakes that they've made -- perhaps even those that were not immediately apparent as being mistakes at the time -- for as long as possible. A trash is a step in that direction, but simply does not go far enough.
My proposal is this: 1st it should be recognized that when you delete a file, you're really only marking the space where that file was as being available to be overwritten by more data. The original data is there, but what it consisted of, and where it was, are lost.
So, let's keep that information in a log so that we can in a very real sense undelete anything that has not yet been overwritten. This log is not especially large, and with modern drive sizes is not a serious concern.
Then, let's order the overwriting process to favor the maximum preservation of data. So for example this might result in new writes being done to the areas of the oldest deleted files first. Important files might be considered to be worth preserving longer, with importance dervived from various factors such as number of accesses, etc. prior to deletion. There's definately work for some user testing here to determine the optimal method. That's okay.
If fragmentation is a worry, (bear in mind most people have never heard of it) then defragging software could take into consideration the undelete log and continue to preserve as much of the deleted data as possible when it shifts information around on the disk.
In any event, the objective is to forestall the day when you have to tell a user who wants to undelete a file for as long as possible. Not longer, which the trash solution does, but AS LONG AS POSSIBLE.
Possible solution. (Score:3, Interesting)
Perhaps the thing to do would be to use two file tables. The first table would be used normally as it is today. It would represent existing files and provide the correct information regarding space usage etc.
The second table would only be used by the file system and the recovery utilty. The second file table would maintain the information of the files that had been marked for deletion and the file system would consult this table prior to saves so as not to overwrite the files that were marked for deletion.
When the disk becomes full, the file system should consult the second file table and overwrite the oldest file that had been marked for deletion.
Also, the recovery utility could consult the second table, listing the files that were marked for deletion but, still reside on the disk. Files selected for recovery could then be added back to the first, primary file table making them again available for the user.
I'm not sure how Novell does it but, the above method would yield the same behavior as the Novell system.
Re:Possible solution. (Score:3, Informative)
A more viable solution might be to take into account the above suggestions with the added idea of moving the data to the end of the drive during 'deletion' while still marking the space as available; albeit a new class of available which preserves data integrity based upon importance. This saves you from insane fragmentation and lower disk performance, and allows you to continue to maintain data integrity long after deletion. Two tables is again, twice the work, but a modified table which takes deleted information viability into account would certainly be useful. Issues such as security and performance are still in question, however, as well as how to implement such a table along-side existing file systems in such a way as to not break functionality or lose data. Backwards compatability and data security are probably the biggest issues, although preserving file permissions solves half of the security problem. Secure deletion must also be a choice for users eliminating sensitive data who don't want it recovered or viewed ever again.
Re:Possible solution. (Score:3, Insightful)
And that's fine, but don't assume that your particular usage is indicative of the vast majority of the masses. I do happen to use my hard drives, often pushing them to the point where the cpu is sitting at 20% waiting for the drive to feed it some data.
"The drive doesn't give a damn what those bits are, it has no concept of full or empty, it just reads and writes where its told. Your filesystem may have issues when you hit 50-80% capacity, but that doesn't have anything to do with the drive."
Well, if you'd like to get technical (as well as snitty), the drive has no "concept" of anything, as that would pre-suppose cognizance. In any event, if you look through any of a number of benchmarks (I personally like HDTach) which may either use a filesystem or not use one to do their work, you'll see that where you're reading/writing on the drive does have an effect on the performance. The filesystem generally cares only in that the fragmentation level tends to be higher at high disk usage, and it becomes increasingly difficult to defragment a drive as the free space dwindles.
I'm not sure what you'd like to call a "typical desktop system", but I can tell you that if you take two systems with identical specs except that one has a 2GB 5400RPM drive with 10MB free, and use it along side another with a 36GB Cheetah X15 with 35GB free space, you'll see a remarkable improvement in many fields, especially games, photo/video/sound editing software, and anything else that requires writes/reads from the hard disk and/or swap file. If you don't think that the performance difference matters most of the time, then I think you ought to send a resume to Redmond, WA, as I'm sure you're just the kind of person they're looking for there.
Fragmentation. (Score:3, Insightful)
You could make a usable system that's somewhat similar...it could shift files around and use, say, a third of the free space for old files.
Re:Fragmentation. (Score:3, Insightful)
That's expensive. That *will* fragment files badly.
Now, say you propose defragging on the fly. If you have a fragmented series of files, you have to defrag on the fly while doing writes. Plus, your disk is essentially always 100% full, *and* to make this a sane system, all of your operations have to be atomic. This is a worst-case scenerio for defragmentation. If you've ever tried defragging a full FAT32 filesystem, you know what I'm talking about.
So what *used* to be slapping a chunk of data down onto a disk now becomes a number of moves of data to defragment files, plus your initial write. These defragmentation moves need to be atomic, so you need to be writing some other metadata on the disk. Not only that, we're doing *far* more seeking. Seeking is mind-blowingly expensive compared to writing that chunk of data from before, and the fact that we have to flush the buffers frequently to keep things atomic means that we can't combine as many writes, which means worse seeking.
Without a real world implementation with numbers, it's hard to show you how bad this would be, but every filesystem I've ever used would be far, far, far faster than this.
Re:Fragmentation. (Score:3, Insightful)
I'd rather see this implemented in ext3 than ext2 for the obvious journalling benefits
Okay. First, implementing this in ext3 would be almost meaningless. The entire point of journalling is that you always write *forward* on the disk, and update pointers to the newest data. Your writes are nearly always contiguous in ext3. This system, where you have to overwrite positions containing deleted files, would have to dance from location to location on the disk to write a file. Very expensive. You could make an atomic writes filesystem, but it probably wouldn't be smart to make it journalling.
Also, I definitely do not feel that a performance hit would be noticeable. The Novell file system is still BLAZING fast despite the fact taht it is managing hundreds of thousands of deleted files
The number of deleted files isn't the issue -- it's how much free space you have available. I can assure you that the Novell guys aren't taking your approach -- only overwriting something when they absolutely have to do so.
The filesystem would still control fragmentation, just as it does today.
What impact does this have on performance? If you're thinking that ext2 does background defragmentation, it doesn't.
The fragmentation issues stem entirely from the lack of free space -- the file system always has an extremely small amount of free space. That free space is likely scattered around the disk.
I'm not sure of all the ways that ext2 differs from vanilla UFS, but I strongly suspect that ext2 does not have a distinct allocated block list. In any event, a one-table or two-table question really isn't an issue.
Finally, let me reiterate: FREE SPACE. Between about 80% or 90% full, ext2/3 filesystem performance starts to take a nasty hit from fragmentation. If your filesystem is 99% full, you're going to be getting quite fragmented. If you are using the proposed system, you always have just a few killobytes of free space (the space left over in what used to be the oldest deleted file).
Novell had this... (Score:2)
Novell Netware's FS worked almost exactly like this. It was a wonderful feature. I don't understand why more implementations have taken this into consideration...
Re:Not a solution- a landfill! (Score:3, Funny)
i prepose the e-landfill. an online service that you can configure your trashcan to use a daemon process (garbagemand) that automatically ships the contents of the trashcan via a secure protocol (rubbishtruck/garbagetruck.. as known as RT/GT) to the e-landfill.. there the deleted file can pile up forever or at least until it is full then we just open up another landfill!
Great idea!
partly real (Score:2)
Hmm... Interresting? What about filer? (Score:2)
What we need now is (Score:2, Insightful)
False sense of security (Score:5, Insightful)
better solution (Score:3, Informative)
alias rm="del"
echo "* 4 * 1 *
del:
#!/bin/sh
mv $* ~/trash
Re:better solution (Score:3, Informative)
Its called backup (Score:3, Insightful)
Undelete on linux isn't something new... (Score:2)
Complacency (Score:2)
just makes it that much more harsh when they
learn that something delete from a remote filesystem is irretrievable. "Undelete" creates bad habits.
Re:Complacency (Score:3, Insightful)
But I have one (Score:2)
I flipped over to another virtual desktop and found that GNOME has already provided me with a trashcan. (More like Mac than Windows.) I never use it, though.
If this is a trashcan for command-line rf, I can see how some people might want to use it. Not me, though.
Linux needs this at the filesystem level ... NOW (Score:4, Insightful)
I'm not worried about *me*. When I delete something I fine with it being completely gone. What about completely clueless network users though? Being the MIS/IT MGR for where I work having access to "salvage" on the Novell Netware file servers is a wonderful tool for users mistakes.
Classic example: last week one user created a Excel spreadsheet to be completed by another user. The second user opened the spreadsheet from Word, modified it, and saved it (as a
Getting the inserted table [spreadsheet] from Word back into Excel was next to impossible. Crappy Microsoft programming as usual -- and clueless users to boot. Easiet solution was to salvage the original spreadsheet and instruct user what NOT to do and re-enter the damn data PROPERLY this time.
Linux would have left me high and dry. Well, not really, but having to go back to tape backups to simply salvage one file is a pain in the butt.
I guess Linux will be nothing more than a niche product/market if "gurus" keep their attitudes posted here. Wake up and pay attention to corporate users and admins wants/needs. Telling me I'm clueless and wrong won't gain more market share (well, for Linux at least) -- I've recently bought another Netware license to cover just this issue for another remote office.
I've got a Better Idea (Score:2)
The backup thing WILL save your ass eventually and that 1 time is well worth the cost of a CD burner if you don't already have one. Once you get used to CVS or some other version control, you'll wonder how you ever got by without it. Even without the "Oops! I didn't MEAN rm -rf * .txt!" protection it buys you, versioning of your files is damned nice.
rm revised! (Score:5, Funny)
USAGE:
rm
-f fuck off with your trash bin, I'm deleting this file.
a better solution... (Score:3, Interesting)
On a similar note, it would be really nice if the filesystem kept a backup of the previous file metadata (specifically, owner, group, and permissions) so that you could "undo" an erroneous chmod or chown.
The total amount of data that would need to be added to the inode to support this kind of recovery is not all that large: The user, group and permission backups would require only 4 bytes each (total 12 bytes) and the saved filename could make due with as few as 32 bytes (most filenames are much shorter than that, and the saved filename is just a hint to the user). It would be nice to be able to reconstruct the entire file with only the data blocks and the inode, so the inode and data blocks would need to have linkage pointers to associate them together. All told, the inode would need about 64 extra bytes of information and the data blocks would need an extra 8 or 12 bytes of overhead.
And, yes, I've been thinking about this for a while: it's near the top of my 'to-do' list of neat open-source projects.
I'm Torn (Score:5, Informative)
Having said that, even though I know how dumb it was, I once accidentally issued `rm -rf
For some reason or another, I happened into an additional hard disk that I put into my Linux box at work (not a production box). I don't remember how big it was, but it was big enough relative to my primary disk that, when I needed a mount point, I chose
Actually, that wasn't my first mistake. My first mistake was running as root.
I mounted the disk and played around with it. I suspect that it was my first time playing around with an additional hard disk, so I copied files over and examined "df -k" and so forth, and eventually I guess I decided to unmount it and do it all over again... I probably would have done endless, mindless file copies for the rest of the day, I was so thrilled with it. Hey, I was young.
This is where it gets embarassing. Perhaps everybody has some mysterious glitch which adds confusion where there should be none. Yes, I honestly do know the difference between a symlink and a mount... I swear it. But in the very brief period of time that it takes to type a command, I sometimes confuse the two in my mind and try to unmount using the "rm" command. More specifically, "rm -rf".
I also noticed on that day that we humans have kind of a built-in autocompletion. If you type the first few letters of your last name, you have a tendency to follow through with the rest of it. And that tendency increases dramatically the closer you get to the last letter. The way I noticed this was when I attempted to issue `rm -rf
Just so you know, there are a great many important things in
This story also reminds me of the time I evaluated WS_FTP Server when it first came out. I needed an FTP server so I could go home and work on some files on an NT server. I wanted access to the whole box, so I set up my FTP account's home directory as c:\ -- I had no idea that when I deleted that account it would attempt to delete the user's home directory, even if it was c:\.
I've never heard a disk thrash like that before or since. And you've never seen anybody turn a box off as quickly as I did when I realized what was going on. Alas, it was too late. Reinstallation and backup restore (yes, I had a backup) commenced immediately. By the way, I've never fully accepted responsibility for that -- I still feel like it should have said "You're about to delete c:\ and all of it's subdirectories. Are you sure?" Because I really didn't think it would do that.
Anyway, my point is that "there, but for the grace of a godlike substance, go you". It's really easy to say we're too good for this, and there's a damn good case that a linux trashcan is not necessary, but for those who want it I think it's a cool piece of code.
That is all.
RP
Dammit! (Score:2)
"you shouldn't run as root AND use rm -rf and THEN decide that you shouldn't have done that."
Sorry.
Real-life Analogy (Score:2, Insightful)
Yeah, yeah. I am not leet.:)
safedelete (Score:4, Informative)
And I don't get these people saying they are too smart to need an undelete capability. Must be nice!
The TCT (Score:4, Informative)
From the FAQ [fish.com]:
"Take this object, but beware! It carries a terrible curse!"
The advantage is has over some recovery options is that it's entirely post-mortem. If you just deleted the boss's laundry-list, you could go download it, build it, and stand a pretty decent chance of recovering your file.
The disadvantage is that, perhaps like a real autopsy, it's not for the faint of heart [fish.com]...
I don't think this is the right solution... (Score:4, Interesting)
I think underlete should be handled at the application level, ie. in konqueror and nautilus, etc. Maybe alias rm to something else for the command line.
Potential gotcha (Score:3, Informative)
This appears to work by placing itself ahead of the normal libc when it comes to dynamic library loading. Very neat idea, but it won't work on libraries which don't delete files by making calls to the shared library. The most common instance of this will probably be statically linked binaries. On FreeBSD, almost all of /bin (including rm) is statically linked, and it wouldn't surprise me if this was true on a Linux distro or two.
So be wary of just installing this and playing with rm - you might give yourself a nasty surprise :) You can check whether rm is statically linked by running ldd `which rm`
RM protection in 5 characters :\-i (Score:3, Interesting)
so cd to all of your really important directories (/,
what it does is create an empty file named -i
when the shell expands * the first file it lists is -i, which rm interprets as an option for interactive mode, so you have to confirm each deletion.
I am thoe original author of this shell script, consider it GPLd.
Why not do it for real? (Score:4, Informative)
It shouldn't be all that hard to do this in-kernel, so it doesn't have library-preload dependencies or side effects and catches even stuff that comes into the kernel from unexpected directions. All you need is a dirt-simple filter driver that you push on top of the filesystem to change delete/unlink calls so they move stuff into the trashcan, plus some ioctls to view/empty it.
Oh, wait, Linux doesn't have filter drivers. For a moment there I forgot we were talking about a "technically superior" OS.
Re:Here's a Handy Hint (Score:2, Funny)
Re:Here's a Handy Hint (Score:3, Insightful)
rm *.mp3
Or so I thought. I had actually accidently told my linux install to do the following in my ~/
rm *
If you cannot tell, there is a " " between "*" and "." As you can imagine this has a very undesired effect, even though I saw it quickly after hitting enter and mashed the ^C as fast as I could.
Undelete would have been useful then. Yes, its a dumb mistake.. but things happen!
Scott.
Re:Here's a Handy Hint (Score:2)
I don't see how people could believe that your post was "Insightful". It's not Insightful it's trash (no pun intended).
This is something that would make Linux *more* attractive to Joe-Blow. Come on.
Re:Here's a Handy Hint (Score:3, Insightful)
Is it that hard?
And this my friends is the attitude keeping Linux from wider acceptance......
Re:What a drag (Score:3, Insightful)
Moron.
Re:What a pompus post... (Score:2)
So what's wrong with providing a solution to those who want a trashcan? Maybe you are so much more experienced than most users (what 20 years of computer use? AMAZING!!!) but what's wrong with giving people an option?
You only "bastardize" it if you make it mandatory.
Re:What a drag (Score:2)
Darn, the common person isn't allowed in the Linux treehouse!
Re:What a drag (Score:2)
Re:What a drag (Score:3, Insightful)
Because the world does not consist of perfect people. Most people will f*ck up from time to time and hose something that they didn't want. While I won't be installing this on any of my systems I'm sure that some of the more consumer-oriented distros might want to add this type of functionality to their products.
That being said, I could see how something like this could be beneficial to many people, so having it as an option is a Good Thing. No one is forced to use it, but it's there for those who do.
Re:One solution (Score:2)
Oh god, that sound is the average IQ of this place dropping by another 10 points.
If Perl is already installed and being used, then the fact it's 1194 files is immaterial.
You could always use sh you know. Or bash, or PHP or even C. Or you as equally clueless which those as you are with your comments?
Re:Run as root, and alias rm to mv (Score:2)
Goes to show how easy it is to get anything you need out of Linux, just by thinking about it for a minute or two and never again afterward.