Re: Renaming lost+found

Andreas Dilger (adilger@turbolinux.com)
Mon, 29 Jan 2001 00:17:12 -0700 (MST)


H. Peter Anvin writes:
> Hello people... the original question was: can lost+found be
> *renamed*, i.e. does the tools (e2fsck &c) use "/lost+found" by name,
> or by inode? As far as I know it always uses the same inode number
> (11), but I don't know if that is anywhere enforced.

Bzzt. /lost+found just happens to use inode 11 on 99.9% of filesystems
because it is the first inode available when mke2fs is creating the
filesystem. If you check <linux/ext2_fs.h>, it has:

#define EXT2_GOOD_OLD_FIRST_INO 11

It is perfectly acceptable to delete lost+found, and create it again
with mklost+found, and chances are it will have a different inode...
Just tested it, and sure enough, I got inode 612 for lost+found this time.
I'm pretty sure that e2fsck looks for the name /lost+found, rather than
inode 11.

This means that with stock e2fsck, mke2fs, mklost+found, you can't rename
lost+found and expect anything to work. However, I would imagine it isn't
_too_ hard to change these tools to create a different directory, and for
e2fsck to look for the standard or the new directory to put nameless inodes.

Looking at the e2fsck source, there only appears to be a single instance of
the string "lost+found", in e2fsck/pass3.c:get_lost_and_found():

static const char name[] = "lost+found";

Same with misc/mke2fs.c:create_lost_and_found() and misc/mklost+found.

Cheers, Andreas

PS - don't blame me if you never find your files after a bad crash. At
least when it is called "lost+found" you occasionally have a look
in there.

-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/