Undelete In Linux
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."
http://ask.slashdot.org/article.pl?sid=02/09/29/02 7256 for a similar discussion.
PDHoss
======================================
Writers get in shape by pumping irony.
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.
Conversion Rate Optimisation French / English consultant
now we have almost everything we need:
[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!
Come on, recycle bins are no fun at all. Where's the fun in having the files you "delete" stored in a folder until you REALLY want to delete them. It's much more fun to delete files knowing that there's a chance you may need them in the future and have no way of retrieving them (unless you're responsible and back your files up, but then again, what's fun about being responsible?).
"Herbivores eat well cause their food never, ever runs."
I don't understand why there are so many people saying this is bad or implying that people who use Linux don't need it because they are so good. I must have missed the evolutionary step that made all Linux users so perfect that they never make mistakes. That is all the Recycle Bin is.
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.
[x] Trashcan support
[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
Way back when Apple sued Microsoft for ripping off the look of their interface, Apple lost. The ONLY thing they got the judge to concede was the Trash Can was theirs. Thus, MS changed to a recycle bin -- a sideswipe at the Apple-California neo-environmental stereotype.
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."
Learning HOW to think is more important than learning WHAT to think.
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?
when I was in college some people and I did a Linux Undelete on the kernel using the ext2 filesystem. The whole procedure is described on http://amadeus.ece.uprm.edu/~undelete. The problem was we didn't found enough people to supported on greater kernels. I think it could be easily ported to ext3.
Please ignore the idiots above -- the l1nux-l337 are always a pain in the butt about usability issues. As a response to the ask-slashdot rfe from last week, this works really well.
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.
While a trash can is nice to have, this doesn't fundementally address the issue of retrivability of accidently deleted information. That is, there is still going to be a step where information is going to be classed as unretrivable even when it COULD be retrieved. (i.e. when the trash is emptied)
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.
-- This and all my posts are in the public domain. I am a lawyer. I am not your lawyer, and this is not legal advice.
I was thinking about filer last night, and this morning, we get libtrash. People have always had issues with deleting files. I personally keep a ~/bla/ directory. I move unneeded things there. If I don't need the files after a few months, I trash the directory, and recreate it. The concept is still better then an undelete, but I remember deleting some very important files on my first linux system... like vmlinuz and the /boot directory because I did not know better.
What we need now is the Gnome (or KDE) panel set LD_PRELOAD so that all application can use libtrash.
-- 1.e4 c6 2.d4 d5 3.Sc3 de4: 4.Se4: Sd7 5.Sg5 Sgf6 6.Ld3 e6 7.S1f3 h6 8.Se6:
So, what happens if you send something like ld.so, or your kernel into the recycling bin? Experimenting by randomly moving stuff you don't understand is never a good idea. Just sending it to some sort of recycling bin just gives folks a false sense of security and could lead them to completely hosing their entire install.
mkdir ~/trash /bin/rm -rf /home/*/trash" >> /etc/crontab
/me nods
alias rm="del"
echo "* 4 * 1 *
del:
#!/bin/sh
mv $* ~/trash
"Quoting famous computer scientists out of context is the root of all evil (or at least most of it) in programming." - K
Obviously someone wasn't around for the great RM stampede of 98...
So you must never wear a seat belt either because you've never been in a fatal car accident.
Moron.
-- This and all my posts are in the public domain. I am a lawyer. I am not your lawyer, and this is not legal advice.
Don't delete anything, till it has been backed up. You do back up your data, right?
Back in like '94 a friend of mine in school wrote an Ext2 undelete program, which of course I no longer can find online... He doesn't have it listed on his webpage any more.
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?
Avantslash - View Slashdot cleanly on your mobile phone.
Having your users accustomed to "undelete"
just makes it that much more harsh when they
learn that something delete from a remote filesystem is irretrievable. "Undelete" creates bad habits.
-fb Everything not expressly forbidden is now mandatory.
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.
Secession is the right of all sentient beings.
I've been a rabid Linux user from the early days. Today Linux handles DNS, Email, and Web services on my networks...it does NOT handle file access for JUST THIS REASON (lack of undelete).
.XLS file). Excel says it's corrupt (it's a Word document now).
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.
Once upon a time I wanted to delete a couple stray mp3s I had in my home directory, so I issued the following command:
.mp3
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.
Wow, you are so special and smart.
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.
I use pico. I think it's rad.
The Internet is generally stupid
I think that you are on to the right solution.
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.
One of the more charming aspects of *nix is that it's designed by and for people who have a clue. The more you make it easy to use by the common user, the more it becomes bastardized.
Darn, the common person isn't allowed in the Linux treehouse!
Yeah, that would about do it. In fact, that's a pretty simple and easy to set up idea.
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.
...
I know in my heart that there's no need for this on Unix, because you shouldn't run as root AND use rm -rf and THE decide that you shouldn't have done that. There are safeguards in place and, after all, since you're a Linux superuser, you're either good enough that you don't make that kind of mistake or the system isn't important enough for it to really matter.
/bin`. Funny story, though:
/big. That was the first mistake. I have no idea why I felt the need to mount it that close to the root. Although the similarity between "big" and "bin" is obvious in retrospect, it is, after all, retrospect.
/big` and immediately pressed return (I found that return is also a mysterious part of that autocompletion).
/bin. Among them, all of the shells, chmod/chown, grep, kill, ls (try working without that), mv.... the list goes on and on.
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
really? That's you. That's not the majority of people out there. Some people really want this. Especially the people that feel that Linux should become part of the desktop market.
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.
Hate it when a funny story is screwed up by a blatant typo:
"you shouldn't run as root AND use rm -rf and THEN decide that you shouldn't have done that."
Sorry.
17+2i
lysergically yours
Often, when I clean out my papers, binders, and whatnot, I end up throwing out stuff that I do need. Being able to root through the trash and retrieve it five minutes later when I come to my senses is very convenient.
Yeah, yeah. I am not leet.:)
Is this a sigs-optional kind of place? 'Cause I am totally down with that if you know what I mean.
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...
http://kered.org
So If Apple has legal rights to "Trash Can" and MS has "Recycle Bin" I think we should call it the "Grot Shop", as our repository for rubbish... in honor of Reginald Perrin.
I always did like the way the Brits commonly use the term "rubbish" for trash. It's got a classier sound to it.
After losing eight hours of editing work during a botched backup attempt, I heard about a utility called safedelete. I can't find much on it, but here it is from Ibiblio. Interestingly, the person that told me about this utility (which sets up a trash directory with timed expiration and a system of aliases for rm and related commands) was an old Unix hand, and only secondarily a Linux user. The program works fine in Debian, I can report.
And I don't get these people saying they are too smart to need an undelete capability. Must be nice!
*** "Freiheit ist immer die Freiheit des Andersdenkenden". -- Rosa Luxemburg ***
Your app doesn't intercept the unlink system call. it intercepts GNU `rm'. Most applications don't use GNU rm to delete files.
Ok
You really can stop replying to this thread.
Really.
You might even try to do the really insane idea of instead of replying to this and telling me I'm wrong/I'm an idiot, you could start a new message and tell the world why linux needs an undelete.
Really.
Telling people why you're right is a heck of a lot more effective then telling me that I'm wrong.
The Internet is generally stupid
[x] Trashcan support
[X] Easy to use Windowing system - WindowMaker - quietly delivering the usability other noisier projects only aspire to for years.
[X] Standard software install system - *cough* it says *standard* - Tarballs
[X] Easy to use Windows filesharing - KDE, Samba
[X] Easy support for video files and DVD - see http://mplayerhq.hu/
[X] Desktop company support - Legions of answers here, a competitive marketplace is good for the consumer.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Friends don't let friends enable ecmascript.
Is it that hard?
And this my friends is the attitude keeping Linux from wider acceptance......
Technically, you can use a pint mug to drink champagne. But most people prefer to use a champagne glass or a flute.
;-)
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
~~~
>> tell the world why linux needs an undelete
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.
I have the solution! and it can be a HUGE moneymaker.
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!
Do not look at laser with remaining good eye.
This is what happenned to me when I tried aliasing rm ...
First, I aliased rm to "myrm" where myrm would put the files/directories inside ~/tmp/trash
If I wanted to really delete a large file I'd use \rm largefile.out (in bash, \ is for the real rm), and soon, instead of rm, I started using \rm. Meanwhile, my labmates used the alias and filled the entire disk with ~/tmp/trash files (nested directories, large files -- several versions, and so on).
S
Actually I have been doing this for several years as an admininistrator and developer on a UNIX box. This software appears similar to what I have done for my users and myself which is rewrite the "rm" command in the users profile. All users including myself have had the rm command supplimented to mean "mv [file] /home/$USER/garbage."
:) Oh, by the way this has been a stable release for about 8 years now or since I first learned it could be done. I have had 100% success with no failures. :)
I then have a cron job that runs to evaluate the age of the files in the garbage directory. It will automatically clean the garbage directories of all files that are older than 14 days. The cron job currently runs once a day.
By the way I even caught I a guy that one of the companies I worked for hired to do an attack and penetration test because of this little fact. He set a job to run after he logged out to clean and clear out the general and host specific log files. He did not account for the fact that I change the rm command's meaning. I found his file lingering in the garbage directory of a temp account. HEHE... gotta love UNIX.
"Help me Obi-/.-Kenobi,your my only hope!" -$
The point I was making, for the benefit of those who couldn't quite grasp it, was that loading into memory a great big executable, with however many shared libraries and other dependent files perl requires, is overkill. A one line shell function in everyone's .profile will do the exact same job.
/. want to show off their leet coding skillz and solve every problem with Perl, when it so often isn't the right solution.
So many people, especially here on
Get that? Or are you equally clueless at understanding follow-up posts as you are the originals?
I have been using computers for over 20 years. I have never, ever, ever 'accidently' deleted an important file.
Unfortunately, not everyone shares your fine mental and physical coordination. Who should we be designing for -- the exceptional people such as yourself, or the lumpenuser who, on making a mistake, would like some way to easily recover it? How many more are there of them than there are of fine specimens such as yourself? Couldn't you just grit your teeth while you disable this unnecessary feature, secure in the knowledge that your momentary sacrifice has enlightened the lives of millions less fortunate than yourself?
deus does not exist but if he does
It's more like not wearing a seatbelt while playing GTA3.
It's not like you actually *die* if you lose your files. It just sucks because you have to start over.
Never trust an atom. They make up everything.
Personally I don't have a big need for a trashcan. And most *NIX vets barely need it. Only the masses may have need for such stuff, specially when so many Windows users are coming up. However I would damnly congratulate the nerd who would put in default such a feature on the next distro. Every experienced hacker knows perfectly that trashcan solutions are frequently THE reason for loosing performance. For individual removals this may look no so critical but when things come up into whole folders and thousands of files, we get some trouble.
Anyway a save removal system should be potentially in place over every file system. Moreover, this safety mechanism should be inherent to the filesystem itself. With the chance to choose what I want to safeprotect or not. Under such approach we could meet a middleterm between performance and safety. Besides such approach would allow to cover a problem where most backup systems can't have a voice - safeguarding highly critical data in a more realtime basis. Yes, such safeguarding mechanisms will not be good for the real realtime situations. But they would be quite good for protecting and recovering by-hour or by-minutes cases. Sometimes this is much more important, rather than picking up last-day's archive and forcing the user to type his last hours of work at the end of worktime and having the boss yelling "I want it now!!!".
If such mechanisms would be implemented they could find a very important niche among sysadmins working with certain types of information - document files, legacy databases, big amounts of data and so on. However such mechanism should regard some safety concerns of confidentiality and control. I fear that in lamers hands it would be much preferable to see the old damn Recycle Bin in their hands.
So, um, what if you like to get under the hood and accidentally delete a file? Why is it so horrible to give users a choice to have a trash can if they want it? I realize that at only 23 I don't have the wisdom of your 20 years of computing, but I've been on linux since a friend turned me onto it at 15 and I know there are times I would have liked to be able to undelete. And why does it matter to me if you're uncomfortable with my having a utility you don't like? And why do you perceive this as Windows-like? If you want to do everything from a command line and be uber-l337, be my guest, but don't tell me what I should and shouldn't do on my computer. Communist.
do not read this line twice.
From the FAQ:
"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...
Except that you didn't say any of that.
So many people, especially here on /. want to show off their leet coding skillz and solve every problem with Perl, when it so often isn't the right solution.
You should try reading Slashdot a little more than once a month.
Actually most people want to show off their 1337 coding skills by reinventing the wheel when something is out there that does the job just fine.
Get that? Or are you equally clueless at understanding follow-up posts as you are the originals?
I understood it just fine, hence my comment about using something else. Which you quite obviously missed.
Good luck with the reading and clear writing course. Looks like you need it.
Avantslash - View Slashdot cleanly on your mobile phone.
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.
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Getting the inserted table [spreadsheet] from Word back into Excel was next to impossible.
Hardly.
Step 1: Select table in Word
Step 2: Copy table to clipboard
Step 3: Open new Excel Spreadsheet
Step 4: Paste table back into Excel
Sept 5: Give original user license to beat the clueless person who messed up his/her spreadsheet.
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`
The only use I see for something like this is one abstraction layer from major GUI toolkits like GTK and QT. I say this because the only times I have problems such as accidentally deleting a file are when I'm using a GUI, and decide to use menu options (such as in GQview). If I'm looking at some photos that were emailed to me, and I want to move them, what if I accidentally click the 'delete' option, which is right next to it? Those files are lost.
I -can- see the use for it, but I don't really see any reason why it should be one level below console (which is what I'm assuming this library does). Granted, there are times that I would have found it useful, even a life saver, but that was due to my carelessness. People really shouldn't be allowed to be careless with computers.
~/ssh slashdot.org ssh: connect to host slashdot.org port 22: too many beers
It is a really efficient way to do this. It was initially done, I think, in 1984 or 1985...
I think the code that's there is for BSD 4.3, but if you've already done the library work...
The overview reads:
Currently Andrew J. Korty is working on a project to port the code to current FreeBSD.- "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
No, just another thing you guys like to take credit for thinking up, even though you didn't. You know, like hockey.
Ahhh! I see you're just looking for a ol' Canada vs. US flamewar.
A few notes:
- I've never heard a Canadian say we invented Hockey, we didn't. But we do whip your ass handily at it! I can also gaurantee that your local NHL hockey team is infested with Canucks.
- Basketball yes we invented that and reigned during the early years of pro ball (yes, a long, long time ago). But! the Raptors are looking excellent this year, and we aren't missing our 4 top guys this time (cough).
So, what happens if for some reason the feds (or some other unscrupulous organization) siezes your hard drive and digs up everything you've deleted for the past 6 1/2 years?
Then be sure to let me know about it, because that's one bad-ass unerase utility right there.
-Waldo Jaquith
So you must never wear a seat belt either because you've never been in a fatal car accident.
Nobody that's been in a fatal car accident wears a seatbelt, either.
-Waldo Jaquith
But, I'll point out that deleting the wrong JPEG can certainly break apps that haven't had their error handling written properly. The difference is you and I know how to recover and replace that JPEG even if it has truely been nuked from our systems. Not everyone does. I'd say that's the "comfort difference" between us and "Joe-user."
I'd also point out that moving a file to a tmp folder is *using a trashcan/recycle bin,* you just don't think of it that way. . . and neither does Joe-user, which I guess is half the point. When I first booted up Linux and realized, " Ah, no trashcan," it took nearly a whole second to think, " Well, if I want one all I have to do is make a directory named 'My Trashcan like Place' ( or George, or whatever)and alias rm to mv foo George." But then I wasn't your typical newbie.
Ok, to make it a full blown trashcan some sort of simple database to track where each file came from to effect automatic restores is also needed for Joe-user ( renaming it foo./bar/fred/barney works for me on those rare occasions when I think this is necessary), but the basic idea is simple and to me was obvious and trivial to effect. I guess to Joe-user it isn't.
But as you say, if it isn't the default behaviour, and needn't even be installed on *your* machine, who gives a damn? Are we going to start sending out " You moved that file to a tmp folder instead of deleting it" police?
Any controversy over this is just plain silly.
KFG
In real life we toss things in the trash and the sanitation dept picks it up. If we threw out something we needed most of us just ACCEPT that its gone. We don't go digging through the local landfill.
Yes, that's why it's called the Trash Can or Wastebasket (or Recycle Bin if you think MS invented the Desktop interface). The point is that this is a place files go *before* they're picked up by the sanitation department and lost forever. Are you saying you've never tossed a paper into a basket by your desk only to take a second look at it 10 minutes later?
Also, it's worth pointing out that the original Desktop interface (Mac's System 6 and earlier), the contents of the Trash only survived until you launched the next app or rebooted (except for Multifinder). Once you put a file in there, it was on its death nell. Different from System 7+ and MS Windows where files stay in the Trash/Recycle Bin indefinitely until you manually Empty (the) Trash.
Hire a Linux system administrator, systems engineer,
This is not always true. Imagine having a piece of medical hardware that's computer controlled. Or imagine skimping on simulating the design of a building due to lost files, where the building eventually collapses.
Of course, we don't even NEED such extreme examples. If I'm working on a project and I lose my work then that's already bad enough to justify such features! Don't people claim that one of the virtues of Unix is its uptime? Well, if crashing is not a big deal because it only takes a few minutes to reboot, why all the big deal?
Peoples' work isn't a video game. It is often serious enough to them to require GREAT care on the part of developers to keep them happy.
-- This and all my posts are in the public domain. I am a lawyer. I am not your lawyer, and this is not legal advice.
I'm sure everyone else is going to be asking the same thing, but why do you need a cmd line trash. The 'normal' user who doesn't understand that when you delete something it goes away forever isn't going to be using the cmd line, they are going to be using x-windows, most likely in the gnome or kde flavor. Its pretty easy to make a folder named "trash" for them to drag stuff into if they don't want to delete it.
If I decide to go drag racing in my brand new Cobra 2003 and total it, is it the fault of the manufacturer or the fault of me?
What if I don't have a drivers license?
Why the fuck should YOU care, if I fubar any of my own stuff? As long as I don't hurt anyone - who the fuck cares?
We do not live in the 21st century. We live in the 20 second century.
So in othe words...
If Microsoft develops a concept (or Apple in this case I guess) that might be useful to Linux users, we shouldn't develop something similar because instead we should just buy Windows? That is just plain stupid.
Linux is nothing like Windows and it will never be. But there is nothing wrong with adding functionality that people will find useful, although, I can't see why one wouldn't just make an alias to do this instead as another poster mentioned...
Slashdot has had major software announcements for a long time. The idea is to provide an interesting medly of content that keeps nerds happy. When PHP forum bugfix notifications start coming up on Slashdot, then you can complain
There's been a lot of discussion about having a form of undelete in Linux on Slashdot. This is quite relevant.
May we never see th
cd /; chmod -R 444 *
Seriously, why does anyone need a trash bin? Disk capacity is so ridiculously large that there is no need to ever delete anything. If you need to reorganize, make directories like oldjob, oldstuff, etc and just move the stuff into there and forget about it. It works just like a trash bin, except that you don't need to worry that the stupid machine will empty it.
The Mac OS had a Trash Can from its introduct in '84. I believe that the Apple IIgs shipped with an OS with a Trash Can, and it wouldn't surprise me if the Lisa did the same.
May we never see th
:>\-i yes it looks like line noise or an emoticon, but it's really a shell script. This protects against rm *.
/etc, /bin), and type :>\-i
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.
I always mount with noatime. Nothing I hate worse than constant background writing on my hard drive.
May we never see th
mplayer is a bitch to install, but awfully simple to use once it's in. And in terms of performance and flexibility, it can't be beat.
May we never see th
And what percentage of "normal users" install their own software instead of getting someone else to do it for them on Windows?
May we never see th
This isn't an issue of "lighting fast". The proposed solution, at least without serious modification, would massively fragment the hard drive. The only reason you don't *care* about fragmentation is because you enjoy the pleasant fruits of the fragmentation-resistant ext2, so you don't realize how bad fragmentation can get. The proposed system would fragment the filesystem so badly that a well-used FAT32 system would look contiguous as hell.
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.
May we never see th
> You should try reading Slashdot a little more than once a month.
I would, but things like this always end up driving me away.
To summarise: the original poster says he'd write something in Perl that would move things to a trash directory rather than removing them.
I point out, admittedly in a childishly sarcastic (but hey, remember where we are) way. that that's using a sledgehammer to crack a walnut.
You point out, in a condescending, superior (but hey, remember where we are) way, exactly the same thing.
I repeat what I just said.
You repeat what you just said.
Someone else chips in having completely misunderstood what we've both said.
The internet is *even more* full of pointless crap than when we started.
So, for what it's worth to move instead of removing, for my ksh user's I'd have an alias to a function calling mv, and in csh and derivatives, just an alias. We agree?
Most of these people (above/below) are not asking for a "trash can". (Tho' kudos to the guy for making it -- another choice.) These people are asking for archive capabilities. (Even *indows archives older, less-used files. Ever notice the little blue files? ) If you are afraid you might need something later on, write it to a CD instead of deleting it. (or have a cron do it by date of the file or something.) This is not so complex. What am I missing here? (I really used to like the way Novell archived your servers by the date of the files.)
Dad32
whatever.
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.
Slashdot - News for Herds. Stuff that Splatters.
1. It's very likely that whatever the undelete command was, that it would have been in the bin as well. It's unlikely that you've be able to run it from the trashcan and unlikely you could have gotten to it without the contents of /bin.
2. Undelete is not for 'rm -rf'. It's for deleting a copy of that invoice/letter/utility you know you'll never need again, only to get a phone call ten minutes later.
No, but after a couple of decades you learn to back up your important stuff before leaving the office for the day ... 'cause, after all, between the human failures, the software failures, and the hardware failures, you can't have too many backups.
That's why you use the old trick of having a file named something like "-normstar" (or anything that begins with '-' and which isn't an rm option). rm chokes on it as it scans argv[] for options, and won't delete your files.
just don't have a file named -rf
must... stay... awake...
There's also the whole problem of library incompatibilities, which is part and parcel of the decision to make shared libraries the standard way for software to work on Linux. That's a classic example of reducing ease of use in return for better performance (smaller downloads) for more sophisticated users.
Find free books.
How about STOP deleting sh!t you don't want to delete?
OK, what about software that deletes stuff you wanted?
I downloaded an MS update once, and it asked where to store it, so I put it on a directory on my server (running Linux), where I put all of my downloaded files.
So as soon as it downloads, it runs, and after installing (I got no warning that it would do any of this) presents the dialog box "Would you like to delete temporary files used during the install process" - so (naturally) I say YES (since it put the damn files in the folder, and it should know which files it created.) It then proceeds to delete the entire damn folder, including all of my other files, which it DIDN'T install, and which I wanted to keep.
Tanget first: The thing that pisses me off the most about windows installers is that they insist on going full screen and requiring you to close or ignore background applications while they are running. I don't want my machine to be useless during an install. Let me start the installer and then do something else while it's doing whatever rediculous crap installers have to do on windows.
One good thing about Windows Installer is that the install is an atomic procedure. That is, if it fails for any reason (file missing, user cancel, etc.), then it will completely roll-back and not leave bits of a partially installed application.
I call bullshit. First, if the installer crashes the system then you're still left with a mess, so it's hardly an atomic process; It only appears atomic if it ends cleanly. Everything else you're describing is handled by any decent installer (including RPM, and dpkg), so it's not something that is nice about the MS installer in particular. Worse, Windows doesn't properly handle unused shared libraries when handling dependancies. Since they are part of an application package they can't be easily uninstalled seperate from the application, but the default behavior is to not delete libraries marked as shared even if their usage count is zero. You need to pick one or the other: delete the libraries when no one needs them anymore, or package them seperately so that they can be cleanly uninstalled. This is one of the most broken parts of Windows.
My point is, is that while it's possible to use different front-end installers, they all use the same back-end, unlike the different Linux package systems.
Each distribution has it's own package management system. On a particular distribution, there is a common installation back-end that is for managing uninstaller applications (usually scripts since administrative tasks are easily scriptable on linux, unlike windows) and dependancies. Stop trying to spew FUD. It's a moot point anyway, because a typical linux distribution is not hampered by a monolithic configuration database, so there is no need or benifit to a unified installer backend in the form you're describing about windows.
Purdue had an unrm package when I was a sysadmin there in 1995, and it was old then. It worked by having a new unlink() that could then be merged in with libc (if you were brave) or linked to separately so you could have /usr/local/bin/rm instead (if you weren't), along with tools that understood how to read the filesystem tomb and restore files from it, and a daemon (preend) that cleaned the tombs of old files. Unfortunately, it has never been extremely portable, since it involves rewriting unlink(). It had pretty much everything you could want in an entombing package; but I don't know if anyone has picked up the ball with it. Last I heard they were having trouble porting it to the newer versions of FreeBSD; check out this note from Purdue ECN.
At least mafia-owned pizzarias make excellent pizza. Compare to Bill Gates.
When you remove a file, from anywhere, it is saved. This means Nautilus, shell prompt, FTP client, whatever. (Tricks involving editing .bashrc need not apply.)
When you overwrite a file, it is still saved. This means if you save a huge edit to a file and then regret it, you can recover the previous version. If I am not mistaken, libtrash does not handle this case.
You can specify some files/directories to not be backed-up. NPRB allows you to specify wildcard patterns, such as "C:\Temp\*" (anything in C:\Temp) or "*.bak" (any file ending in .bak). I like the wildcard feature for "*.bak" and such, but I would also like to see this new kernel feature do the right thing with the "chattr +u" flag, which Linux has had forever but doesn't acutually do anything.
You specify an automatic date for the backups to be purged: e.g., anything older than 3 days old gets purged. A user-space utility running on a cron job would handle this nicely.
There should be user-space utilities that allow for recovering a deleted file (to original location or to someone else), and for purging all the kept files to truly get the space back. (And I want a nice Nautilus interface for this stuff.)
When you are up against the wall on disk space, the oldest files get purged automatically to make enough room for a file write. (This one would be nice but I could live without it.)
This would be nice on servers, but I also want it on the workstation!
NPRB is the one big feature available in Windows that I really wish for in Linux.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
A couple of years ago I heard about something called the "snap filesystem" which would allow for recovering deleted or overwritten files. But I haven't heard of it since, or seen anything on the web. Does anyone know anything about a "snap filesystem"?
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
This is primarily intended for backups of volatile filesystems, such as databases. You would backup a database like this:
suspend database transactions
wait for pending transactions to finish (so database indexes are consistent)
make a snapshot
resume database transactions
backup the snapshot
remove the snapshot
.mp3" in your home directory, the snapshot would be a huge help. You would get back everything over an hour old.
But if you have a lot of free disk space, you could set up your system to make a snapshot every hour, and keep the snapshot for, say, 8 hours. Then you would have a coarse-grained undelete.
If your shapshots happen on the hour (1:00, 2:00, 3:00 and so on) and the user creates a file at 1:02 and deletes it at 1:40, the snapshot won't help, which is why I call it coarse-grained. But if you accidentally do "rm *
It is specifically for snapshots that I plan to try out LVM on my next file server.
steveha
lf(1): it's like ls(1) but sorts filenames by extension, tersely
Absolutely.
It doesn't happen often but when a user saved over an older version of a document in our DMS (iManage) we could count on Salvage to get it (or any other previous version) back.
Having migrated to Samba on Linux for File/Print we now have to resort to tape.
If you don't want to repeat the past, stop living in it.
I'm not trying to frustrate you. I see where you are coming from on the fragmentation issue and I see where this might be a problem in some cases.
Frankly I want this feature more for servers than anything else, although having it on the workstation is an added bonus. But, in terms of servers they will usually use RAID and mine always use RAID 5. In this case fragmentation is often beneficial.
But, the server arguement is just an excuse. The fact is that if fragmentation is such an issue then this proposed file system should not do fragmentation avoidance as ext2/3 does but, rather perform defragmentation functions with a seperate utility as is the case with M$ file systems. I've got no issues with a CRON job that runs a defragmentation process in the wee hours.
One final note: I can assure you that the Novell guys aren't taking your approach -- only overwriting something when they absolutely have to do so.
This is absolutely exactly what the Novell file system has done since v3.1 and has been maintained in all 9 versions since then, right up to today's Netware 6.0. Granted, I don't know how it's coded but, this is definitely the resulting behavior. No file is overwritten until the disk is physically out of space, or very near it. The only exceptions are those that are explicitly configured to "Purge" immediately. If your disk hasn't run out of space, say a really large disk or a really quiet server, it's possible to Salvage a file from six years ago, even if the server has been rebooted everyday.
I don't use a "trash can" on my home linux computer per se, but I do run Logical Volume Manager and one of the _best_ features is the ability to take a snapshot of a logical volume.
/mnt/snap every Sunday morning with enough space (1G) to last all week. During the week I can then recover any file that existed on the previous Sunday morning, but there was no lengthy "backup" process or tape drive or anything. I like it very much.
/etc/cron.weekly/lvsnap: /mnt/snap /dev/big/snap >/dev/null /dev/big/rh >/dev/null /dev/big/snap /mnt/snap
The snapshot uses zero bytes when you first make it, and then as activity happens on your drives it records changes (imagine a "super-diff"). The amount of space you need to allocate to the snapshot depends on how long you want it around and how frequently you write to disk.
I decided this is useful when automated so my home computer makes a place called
Here's my
#!/bin/bash
umount
lvremove -f
lvcreate -L 1G --snapshot -n snap
mount -r
BTW, I don't even have two HD's on my LVM. I just imlpemented it on my main drive for the sheer geekiness of it, i.e. cool features like this one. Yes, before someone points it out, I realize theoretically with just 1 drive LVM makes it slower rather than faster but (a) I didn't notice any speed difference, probably because my CPU is fast, and (b) it's a non-critical home computer.
I'll go for the easy argument:
If all your files are in a RCS... shouldn't it be a function of the file system?
Hockey: It's a Canadian game. Not, it's a game Canada made, but a game Canadians love and tend to center their lives around
Basketball: Did we really invent this? I remember something about lacrosse being originally a Native sport from Canada, never realized we invented basketball too.
Wonder if anyone would be successful on a topic of factual "who invented what" for popular recreation and technology. Last time I heard Americans were trying to steal credit from us for the Telephone/telegraph (Mr. Bell is the man for this, sorry guys)
use trash can, I have a suggestion alias rm "rm -i" .
My Aurora : http://www.youtube.com/watch?v=o91ZsGwJYyg
FB : https://www.facebook.com/TanveersPhotography
[hongli@izumi src]$ rm -rf .*
rm: cannot remove `.' or `..'
rm: cannot remove `.' or `..'
[hongli@izumi src]$