fsck and lost+found space

Peter Jeremy PeterJeremy at optushome.com.au
Wed Aug 11 03:00:27 PDT 2004


On Wed, 2004-Aug-11 09:58:21 +0200, Wilko Bulte wrote:
>On Wed, Aug 11, 2004 at 05:54:35PM +1000, Peter Jeremy wrote..
>> On Wed, 2004-Aug-11 08:17:39 +0200, Nicolas Rachinsky wrote:
>> >* Charles Sprickman <spork at fasttrackmonkey.com> [2004-08-10 23:52 -0400]:
>> >> I was hoping for some option in fsck to allow an alternate lost+found
>> >> directory on another device, but no such luck.
>> 
>> This isn't possible - all fsck does is to create a directory entry
>> pointing to the file.  You could add an option to fsck to allow you
>> to specify the directory name but you are still limited by fsck's
>> inability to use indirect blocks for the fsck directory.
>
>Is this the same thing I remember from SysV days where we used to create
>a ton of files in lost+found and then delete them so that in case fsck
>ever needed dir entries it could re-use them?

The quick answer is no.

I got the impression that Charles wanted to have fsck recover files to
a different filesystem - this is not currently possible and would be
non-trivial to add (the file data would need to be copied).  OTOH, it
would be trivial to change the "lost+found" string in fsck to something
else or even make it an option.

I remember using S5FS.  S5FS didn't shrink directories and fsck
couldn't expand the lost+found directory so you had to pre-grow it by
creating and deleting lots of files.  I don't know if there was any
restriction on growing the directory enough to need indirect blocks (I
don't think I ever had a FS go so bad that it mattered).

When FFS gained the ability to shrink directories, it was no longer
safe to rely on a pre-allocated lost+found so fsck needed to learn how
to expand lost+found.  Presumably to simplify the code, fsck doesn't
have the logic to handle indirect blocks in directories.  It shouldn't
be that difficult to add the necessary code but there shouldn't be
much call for fsck to recover >~5000 files.

-- 
Peter Jeremy


More information about the freebsd-hackers mailing list