[ale] lost+found

Michael H. Warfield mhw at wittsend.com
Thu Oct 29 13:47:46 EST 1998


Ben Phillips enscribed thusly:
> Can someone point me to a good explanation of what lost+found does?

	Lost+found serves a very important task for fsck when cleaning a
file system which was not shut down properly.  If fsck finds an inode (file)
which is not free but not referenced in any directory (an orphan file), it
can hang it in the "lost+found" directory in the root of the file system.
It gets linked into that directory under a name which is its inode number.
The lost+found directory is "pre-grown" out to a certain size so that a
number of files may be hung in there without requiring that fsck allocate
any more blocks to the directory itself.  It already has a good number
of empty file slots in the directory so fsck merely has to update the
preallocated blocks to point to the orphan file.  Remember that at the
time it does this, fsck has to consider the file system to be unstable,
and allocating blocks could, potentially, cause further damage.

	That means that if you accidentally remove lost+found, you can NOT
merely recreate the directory with mkdir.  It would then be missing the
preallocated directory blocks.  You need to use mklost+found to make
the directory and then expand its allocations.

	If fsck can not find enough room in lost+found to hang an orphaned
file, fsck will fail to recover it.

>                       __   _
> Ben Phillips         /  '_' )         ,,,    "I wish I could file suits
> pynk at cc.gatech.edu   |  | ()|||||||||[:::)   against stupidity. The world
>                      \__.-._)         '''    would become a jail."
>                                                       --  Meg Sagi

	Mike
-- 
 Michael H. Warfield    |  (770) 985-6132   |  mhw at WittsEnd.com
  (The Mad Wizard)      |  (770) 925-8248   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!






More information about the Ale mailing list