lost+found dir placement

jb jb.1234abcd at gmail.com
Tue Mar 13 10:02:34 UTC 2012

Robert Bonomi <bonomi <at> mail.r-bonomi.com> writes:

> ... 
> The fsck_ffs manpage says that 'lost+found' is _created_ *when*needed*,
> in the root of a filesystem, if not already present. 
> The presense of /mnt/lost+found is _not_ an error.  just a surperfluous
> file that ended up there 'somehow'.
> ...

This worried me. And still does ...

> *IF* you're going to file a PR, it should be for the filesystem 
> initialization process -- which "should" (a) create the lost+found
> directory, (b) create some 'reasonable' number of files in that directory,
> and (c) then delete all those files.  This ensures that the directory
> exists and has disk-space allocated for a 'reasonable' number of 
> 'recovered' file entries.

That's perhaps why under Linux they have special mklost+found entry ?

> The existing fsck_ffs has a catastrophic failure mode if there is no
> space on the disk for the lost+found directory to grow to acomodate
> the recovered file entries.

I was surprised to find empty lost+found dir in /mnt.
drwx------   2 root  wheel          512 May  5  2011 lost+found
That's why I jumped a bit.

Few days ago, after clean reboot to single user mode, I tested fsck manually
on SUJ fs and found things that seemed to be questionable (I posted it on
current@ list, if you want to take a look).

So, it must have happened during that time, because as I said I did not have
any forced fsck run at boot times, and I almost swear I did not have this
lost+found dir in /mnt before.

I will take a look at source code of fsck* entries and perhaps find a clue.

More information about the freebsd-questions mailing list