lost+found dir placement
freebsd at edvax.de
Tue Mar 13 12:44:52 UTC 2012
On Tue, 13 Mar 2012 10:02:16 +0000 (UTC), jb wrote:
> 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 ...
How "clean" is your installation?
If you have had mounted some UFS file system in /mnt
that has undergone a fsck check where the creation
of lost+found had been neccessary... no wait, it would
be on that partition then. If this directory entry is
present in /mnt which is supposed to be empty by
default, e. g. if "mount" doesn't show something
actually mounted on /mnt, then I think you should
delete the directory entry. Just imagine the "fun"
that could happen if you mount something to /mnt...
However, do you remember _what_ created lost+found
> > *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 ?
Nothing new. In fact, I remember that my WEGA (UNIX system III
derivate) mentiones a command that would create the lost+found
directory, mklf or createlf... as a binary.
> > 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.
It's fully unsurprising to be surprised here. :-)
> 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.
Possible, but in a normal case, lost+found is tied to
a partition (and per implication to a mountpoint). The
mountpoint, if _not_ in use, should be empty.
> I will take a look at source code of fsck* entries and perhaps find a clue.
I posted the file name where you can find the handling of the
creation of lost+found. Just search for this string and you'll
find the corresponding section easily.
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions