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.
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.
[X] Easy support for video files and DVD - mplayer
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.
DNA is the ultimate spaghetti code.
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
At the very least, turn down the disk usage for the recycle bin. Personally, I just set it to 'use the same settings for all drives', then set 'do not move files to the recycle bin', and leave the prompt enabled just in case I accidentally hit delete, and then remove the recycle bin from my desktop (using a registry file I downloaded from OReilly in one of their Win* annoyances articles, which has worked in every version of Windows I've used from 98 to XP).
-PainKilleR-[CE]
Have you tried holding down the SHIFT key at the same time you press Delete when you delete files in file explorier? I think it does what you're talking about... and you don't have to mess with the percentage settings in the trash bin.
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
"[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.
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.
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 ***
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!" -$
All together now...
FreeBSD!
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...
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`
This is the single most important and useful utility for windows I've ever seen. It's so good that microsoft stole the idea and has included a (half-assed partially functional) version of it in windows XP.
It's less useful under linux because it you never have to undo configuration changes and program installs, but it would still be really nice.
It doesn't take *ANY* extra disk space, though there is a minor performance hit. Rather than mark the space as immediately reuseable, it marks it as used for it's logging, and when more space is needed on the disk, it frees up the oldest parts of the log. This can result in fragmentation, of course, but that doesn't happen as much as you would expect, due mostly to the patterns of usage.
On a large, not much used disk, you can easily keep months and months of backup.
For those who aren't familiar with it, goback is a true logging file system - it logs all changes to the file system, to the point that you can say "show me what this file looked like at 7:30 this morning" and it will. You can also mount a virtual disk - including writing capability - to see what the disk looked like last week. If you accidentally revert the hard disk to last week, it lets you revert to this morning, before you reverted to last week. It's impossible (well, difficult, anyway) for even a dumb user to screw up.
I've been using Linux (Slackware, then SuSE) almost exclusively for awhile now, and this is the only thing that I really miss. Is there a true logging file system for linux? Not that I know of!
Please tell me where I can find one?
You run into several problems here. First of all, at the current state of computers, the bottleneck in most machines is the hard disk. What we're doing here is adding additional work for the hard disk, thereby slowing down the computer further. Secondly, by continuing to avoid overwriting data and allowing the drive to fill, you further decrease disk performance. Hard drives generally begin to work more slowly when they become more than half filled, with a more severe and noticeable performance hit at around 80% depending on the drive.
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.
-- "Government is the great fiction through which everybody endeavors to live at the expense of everybody else."
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.
You've already got this under Linux if you use Nautilus as your file manager. It has a trash can.
> Easy to use Windows filesharing is clicking on a button that
> 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.