Slashdot Mirror


Recovering Deleted Files on ReiserFS3?

DarkSarin asks: "I have a rather serious problem: I managed to accidentally delete some files (rather important ones at that!) while trying to back them up to cd (I was using a GUI burning software that will remain nameless for now). How do you recover accidentally deleted files in Reiserfs? This thread (started by me) indicates that you can't recover them. Note that I had found a way to rebuild the tree, but that didn't work. It seems odd to me that you wouldn't be able to recover accidental deletions, but that really does seem to be the case. Help? Please?"

8 of 126 comments (clear)

  1. Good luck... by SanityInAnarchy · · Score: 4, Interesting

    A filesystem has never (AFAIK) implemented a trash / recycle bin folder -- not on Windows or OS X, and not on any UNIX that I know of.

    The reason for this is that a recycle bin is to save you from accidental deletions. If you delete a file from the nice, big, friendly GUI, it usually asks you at least once whether you want to delete it, then instead moves it to the trash. When it's time to empty the trash, it asks you again to make sure you're not screwing yourself over.

    However, many programs create temporary files and then promptly delete them -- so many times that it would be ridiculously inefficient (both in space and fragmentation levels) to put them into the trash. Furthermore, can you imagine looking for your files in the middle of all sorts of files with names like 11025u012348512i51253.tmp?

    As someone said on the other forum, there's the hard way -- grep for it on the raw partition. This may not even work with ReiserFS, I'm not sure. The usual way to protect yourself from this is to back up in the first place (yeah, I know) and to only run programs you trust as a user that can delete files that you need.

    I would suggest that you try the grep method, and if that doesn't work, learn from it. The safest way to do this is (ironically) the command line. If you type "cp", you know for sure it will copy the file. If you type "mkisofs" or something similar, it is very unlikely that it will delete the files. And these tools (along with mv, which does delete the old copy after the new one is successful) have been around for so long and are so simple that the only way you could screw this up is through a very stupid mistake (like rm instead of cp) or using an experimental filesystem, which despite the opinion at Gentoo, ReiserFS is not.

    --
    Don't thank God, thank a doctor!
    1. Re:Good luck... by GigsVT · · Score: 4, Interesting

      On the other hand, an operating system is considered inefficient these days if it doesn't use 100% of the RAM for something or another.

      What use is "empty" disk space? The OS might as well use it for something, as long as it can ditch things that aren't important if there is a demand for space. As for your temp file issue, it's easy enough to just make /tmp and /var/tmp (and any others) a different file system that doesn't act this way.

      Modern file systems don't need to have a limited number of inodes. Even ext3 by default creates way too many inodes on large file systems, if you are going to be storing files of any significant size.*

      I think it's high time for filesystem reform, and it doesn't need anything revolutionary like databased buzzword filled paradigm shifting crap. It's just logical evolutionary improvements.

      *And it wastes 5% of the space by default! That's 100 GB on a 2TB fs completely wasted! Always use -m0 on storage fs's or -m1 on system fs with mke2fs. Use -T largefile4 to make one inode per 4MB, which is fine for storing "large" files. Otherwise the fs takes hours to create all those damn unnecessary inodes on a large fs.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    2. Re:Good luck... by SteveOU · · Score: 4, Informative

      I will point out that the filesystems included in Novell's Netware product did include a deletion-recovery tool, accessible via the salvage command. My understanding was that Netware would not permantently delete a file until that disk space was needed for active data or until a timeout period expired.

      Damned handy tool, too. We had IBM's TSM for our major backup operations, but for those "oops" moments, salvage was sure handy. I hope that the new Novell might consider implementing those features on existing linux filesystems, or at least contribute native linux implemenations of their filesystems.

  2. Stop!!! by zulux · · Score: 5, Interesting

    Take the filesystem offline. NOW!

    Then use dd to copy the partition to another partion/disk. Then mess with the copy.

    A lot of silesystems do a good job at keeping files and their blocks in order. I've had luck with *BSD file-system by grepping for somthing at the begining of the file and grabbing a big chunk of data afterwords. This works great for MS Office Documents, JPEG or anthing that begins with a known preamble.

    This may not work for your filesystem.

    --

    Moneyed corporations, non-working 'poor' and criminal prisoners are turning productive citizens into tax-slaves.

  3. Suddenly... by Anonvmous+Coward · · Score: 5, Insightful

    ...every Windows user looks at that Recycle Bin shortcut on their desktop and smiles.

    (No, that's not really a troll. Human error happens.)

  4. Try this by Anonymous Coward · · Score: 5, Informative

    I really don't understand how this was done. None the less you CAN recover from this. Here's a little tutorial I found. I Highly suggest doing the backup first!!! :

    If you're really really desperate, you can do what I did a few weeks ago. In my \
    case, fsck didn't recover the partition either, indeed it crashed. So here's what's \
    I did from the beginning of what I think fixed it:

    1) reiserfsck --rebuild-tree
    2) mount
    3) reiserfsck -S
    4) debugreiserfs to get metadata for Vitaly
    5) mount
    6) mount again

    I'm not sure why this happened, but after the second mount, the partition was not \
    recognizeable as ReiserFS anymore. I suspect it had to do with a few really huge \
    files that were originally on the partition that reisefsck -S tried to recover. In \
    doing so it probably hosed lots of stuff. Now, it was as simple as

    7) reiserfsck --rebuild-tree

    And I had most of my data linked under lost+found! Took me a few hours to sort \
    through it all but I got back most of what I cared about. Maybe if you use the new \
    pre8 fsck you won't need to jump through these hoops. Since the potential for data \
    destruction is high here, I wouldn't blame you for not trying. And yes, this all \
    happened by trial and error ::-)

    This might help too :
    http://marc.theaimsgroup.com/?l=reiserfs&m=1048613 18421306&w=2.

    Good luck!

  5. Ask Namesys by cornice · · Score: 4, Informative

    Pay Namesys $25. They wrote ReiserFS so they should know. You'll be getting really great support and helping those who wrote your file system. Look here:

    http://www.namesys.com/support.html

  6. Wow this is so easy I'm surprised no one got it by anthony_dipierro · · Score: 4, Insightful

    How do you recover accidentally deleted files in Reiserfs?

    It's really easy. You just restore from backup.