Re: Restoring deleted files under Linux
by Corion (Patriarch) on Aug 22, 2001 at 01:55 UTC
|
Just a small comment :
To make the file recovery "even better", you might want to prevent any writing at all to disk (except swap space) while you are trying to recover the missing file(s), so I would try to buffer all files in memory until you have read everything out from the device in question (in your case, /dev/sda6. Of course, once you take this step, you will also want to consider restoring multiple files (from an erroneous rm -rf foo/ for example), and soon your short hack turns into a big fat program itself :-)
| [reply] |
Re: Restoring deleted files under Linux
by Zaxo (Archbishop) on Aug 22, 2001 at 14:54 UTC
|
Another trick to minimize the chance of overwriting the target blocks:
$ mount /path/to/mountpoint -o remount,ro
This makes that filesystem read only. You must either be root, or have mount privilege for that mountpoint (set up in /etc/fstab). This is difficult for a common development server, but doable for a workstation.
After Compline, Zaxo
| [reply] [d/l] |
Re: Restoring deleted files under Linux
by perigeeV (Hermit) on Aug 22, 2001 at 03:53 UTC
|
Cool script. For the future, the ext2 file system allows inode manipulation, and one can use debugfs(8)to locate and modify inodes directly. Here's a HOWTO, and here's a Perl script. I haven't tried the script though. | [reply] |
Re: Restoring deleted files under Linux
by binner (Novice) on Aug 22, 2001 at 19:55 UTC
|
From the 'promoting existing utilities' dept.
First, I must say 'Nicely done'.
Second, not to rain on your parade, but there is a unix utility (fairly widely available) called recover...it's saved my a** a couple times.
-Ben | [reply] |
|
In addition, a package called "The Coroner's Toolkit"
contains an utility or two for doing this as well. TCT is
a tool developed for doing forensics work on machines that
have been cracked, written by Wietse Venema and Dan Farmer.
It can be found
here.
Glad to see another good tool developed for this - very nice indeed.
--jwest
-><- -><- -><- -><- -><-
All things are Perfect
To every last Flaw
And bound in accord
With Eris's Law
- HBT; The Book of Advice, 1:7
| [reply] |
|
Thanks, I'll have to look into that. This is obviously not the same recover that's installed on my desktop machine:
recover (6) - recover a NetHack game interrupted by disaster
:D
| [reply] [d/l] |
|
MeowChow
s aamecha.s a..a\u$&owag.print | [reply] [d/l] [select] |
|
|
Try:
$ man 1 recover
If it's installed, it should show up.
-Ben
| [reply] |
Re: Restoring deleted files under Linux
by mystik (Sexton) on Aug 23, 2001 at 05:07 UTC
|
'mc', the gnu midnight commander is usually installed on most linux desktops (at least the red hat ones)
We had someone accidentially delete *all* of our client databases. then we realized backups were bad. :( Luckly, we knew enough to stop *all* writes to the disk immidiatly, and we let midnight commander do it's trick. (It only works w/ ext2 disks though -- and it recovers by Inode number, not by filename.) We had to sort through all the files by hand to determine whether they were mysql index'es or mysql ISD files, and for which client they belonged. that was a hectic 2 day hack job ;)
| [reply] |
Re: Restoring deleted files under Linux
by Zecho (Hermit) on Aug 22, 2001 at 23:06 UTC
|
| [reply] |
Re: Restoring deleted files under Linux
by John M. Dlugosz (Monsignor) on Aug 27, 2001 at 07:07 UTC
|
Re not checked into CVS (yet):
For just such an emergency, I have automated daily backups of all my "work" stuff. Overkill, but disk space is cheap, and "just in case".
I also published a "Cheap Mirror" utility that is a proof of concept (under Win32) for doing autobackups when a file is saved, essentially remembering multiple generations of a file.
More musings...
I don't like the "trash can" thing where files aren't really delted until I empty it. But, what might be worthwhile, I think, is a time-delayed delete. Move the file to a temp directory for a few minutes and then commit the deletion. That's long enough to catch such a mistake in the command-line, but stays out of the way better than a "trash can" file. | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Jan 28, 2013 at 02:08 UTC
|
11 years after the original post and you still saved my life. Such a simple idea, and worked perfectly! | [reply] |
|
Hopefully, he'll help mine too :(
| [reply] |
|
| [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Nov 06, 2013 at 19:44 UTC
|
Well, I must say: 12 years after the original post and you still saved my life. Such a simple idea, and worked perfectly! | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Jul 29, 2013 at 04:30 UTC
|
Thanks a lot for posting this awesomely simple explanation! It worked perfectly and helped me to restore 6 hours of work! | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Aug 31, 2013 at 21:41 UTC
|
Hi. I just wanted to thank you.
I had worked on a file for 3 hours and was about to tar.gz a bunch of stuff (including the file). Long story short, I ended up "rm -rf" on the wrong things and deleted the file i just wrote.
I ran your first perl script and was able to recover my file. I am so happy! Thanks! | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Nov 21, 2013 at 18:41 UTC
|
You saved my bacon also - many thanks! | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Jan 16, 2014 at 14:12 UTC
|
A life-saver, this post. Thanks. | [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Jun 19, 2014 at 22:00 UTC
|
| [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Oct 20, 2014 at 20:43 UTC
|
Thank you!!!!!!!! Seriously, your script just saved me and my sanity! | [reply] |
|
Your script is wonderfull !!
I use it 2 times in one week !
1. For save 3days of works.
2. Search a special data and find a lot of information about a device :D
| [reply] |
Re: Restoring deleted files under Linux
by Anonymous Monk on Feb 20, 2017 at 11:02 UTC
|
Hi Please help me...same problem,deleted all files in a folder with rm -rf,whether i can retrieve them. | [reply] |
|
You've replied to a 16 year old post, the person you replied to hasn't logged in for 11 years. Consider trying the methods detailed or using one of the many off the shelf data restoration tools, e.g. TestDisk.
| [reply] |