lost+found dir placement

Robert Bonomi bonomi at mail.r-bonomi.com
Tue Mar 13 08:24:23 UTC 2012

jb <jb.1234abcd at gmail.com> wrote:
> Hi,
> Each fs should have its own lost+found directory.
> It is used by fsck for placing recovered corrupted fs files in there.
> This implies the dir must have already existed (it may not be mounted ad hoc
> e.g. at boot time, during fs recovery).
> In FreeBSD 9, I found lost+found dir under /mnt.
> This is incorrect - /mnt is defined under all standards (Filesystem Hierarchy 
> Standard, Unix directory structure) as "contains filesystem mount points".
> So, lost+found dir should exist under root dir as /lost+found.

Do you have a filesystem mounted on /mnt? 
> Any comments before I file a PR request ?

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'.

*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.

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.

More information about the freebsd-questions mailing list