If /lost+found not empty

Ext2fs Undeletion of Directory Structures mini-HOWTO
Prev |  | Next

# 10. If /lost+found not empty

Some of the directory and files may not pop-up at their right places. Instead they will be located in /lost+found with names after their inode numbers.

In this case the pointer at the ".." directory entry probably have been increased and will point to one of the later entrys in the directory (of some reason I do not know, maybe it is a fs bug).

Examine pass 3 (where directory connectivity is checked) of "e2fsck.out". There you will find which directories that are affected. Dump those to disk (as described in Section 4).

Run e2dirana both with and without the p parameter (it changes the pointer at the ".." directory entry). Here dump is the dumped directory.

            # e2dirana dump > dump1
            # e2dirana -p dump > dump2

Compare the outputs.

            # diff dump1 dump2

If they are not the same there are missing files in that directory. Then move those files from /lost+found to their right place. Here dest is a symbolic link to the destination directory. Put the output in a script and run it if you agree.

            # diff dump1 dump2 |\
              tail -n $[`diff dump1 dump2 | wc -l`-1] | cut -b 3- |\
              sed -e 's/^\([^ ]*\) \(.*\)$/mv lost+found\/#\1 dest\/"\2"/' |\
              sed -e 's/!/"\\\!"/g'

Repeat all this until /lost+found is empty.

Prev | Home | Next
Recalculation |  | Final touch