>> Somehow(don't ask me how, i already lose track of it) i lost my
>> 'lost+found' directory of my root file system. The system seems
>> to be working fine without it. But i wish to be able to get it
>> back but don't know how. Hopefully somebody can answer my
>> questions:
>>
>> 1. What does 'lost+found' do?
>>
>> 2. Is it a terrible thing to lose 'lost+found'?
Sergei> Interesting question. I'm running Linux for 1.5 years
Sergei> without any "lost+found" directory and never thought there
Sergei> maybe a need for one.. Indeed what is it for?
Caveat: The following is based on what I remember from AT&T Version 7
and System III UNIX. Possibly Linux does some or all of these things
differently.
As you know, filenames in Linux (or any UNIX) are just that -- names.
The actual information about the file (size, disk block addresses,
dates and times, etc.) is stored in something called an inode, and the
name in the directory just points to the inode. Inodes reside in an
(what else?) inode table, near the beginning of each filesystem on
your disk.
Now what happens when an inode contains some information but there is
no directory entry pointing to it? It's a valid file without a name,
an orphan if you'd like to call it that. When fsck checks your disk,
one of the things it does is look for these orphaned inodes and
reconnect them to a special directory under some non-intuitive name.
(Actually it uses the inode number as the name.) The special directory
is called lost+found, and there needs to be one in the root directory
of every filesystem (roughly equivalent to disk partition) on your
disk(s).
Why? Why not just reconnect the orphaned inodes to any old directory?
Two reasons I can think of: 1. It's simpler to find lost files in a
well-known place rather than hunt around the whole filesystem. 2. Most
important: the filesystem is (potentially) unstable while fsck is
running, so fsck needs an existing directory _with_free_slots_ to
connect orphaned inodes to. AFAIK mklost+found does not do anything
special: it just creates the lost+found directory, creates lots of
empty files in it and then deletes those files, leaving those slots in
the directory free for fsck's use. You can do it manually if you want.
Hope this helps :-)
--
---
Raj Mathur Senior Manager (Information Services)
The Times of India Group
Times House, 7 Bahadurshah Zafar Marg
New Delhi - 110 002, India
Phone: +91-11-3719425, 3718844, 3312277 extn 507, 583