From: kris@black.toppoint.de (Kristian Koehntopp) Subject: Re: Why have I lost 12MB to lost+found ? (Correction & Question) Date: Thu, 24 Jun 1993 13:49:41 GMT
In <C92x8s.JAs.1@cs.cmu.edu> mhemy+@cs.cmu.edu (Michael Hemy) writes:
>Thanks for all those that pointed out that I had really lost only
>12KBytes. This is still a much larger number then any other directory
>entry has. Is this a function of the partition size?
The lost+found directory is the place, where fsck links in lost
files. In UNIX it may be possible for a file to have a link
count greater 0 (that is, the file is not deleted), but have no
directory entry, if the system is shut down ungracefully.
Such files are recovered by fsck, but since the file is not
linked to a directory, they have neither a name nor a directory
to be put in. fsck puts these files into lost+found with their
i-node number as their name.
When fsck is running, the file system almost surely is in an
inconsistent state. You cannot not be sure where to find free,
unallocated blocks, for example to increase the lost+found
directory to add more directory entries. Therefore: If fsck is
supposed to link lost files into the lost+found directory,
there must be empty directory slots in it. fsck can recover at
most so many files as there are free directory slots in
lost+found.
In UNIX directories never shrink (except in AIX jfs). That is:
If you create many files in a directory, the size of the
directory itself increases. If you delete the files, their
directory entries are removed from the directory and are free
for reuse. But the size of the directory file itself never
decreases, empty directory slots at the end are simply left
behind. The directory is never compressed, also. Used and empty
directory slots are intermixed, making it necessary for namei()
to browse to the entire large directory file, even if there is
only a single directory entry in it. Large directories slow
down namei() performance.
Kristian
--
Kristian Koehntopp, Harmsstrasse 98, W-2300 Kiel 1, +49 431 676689
"Auch das das zweimal drauf ist. Kannst Du das nicht ueberkleben?"
-- Marit Hansen zum Einband von "SAA Power Tools in C"