lost+found dir placement
freebsd at edvax.de
Tue Mar 13 08:11:45 UTC 2012
On Tue, 13 Mar 2012 07:58:09 +0000 (UTC), jb wrote:
> 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).
No. This implication does not exist.
If I read /usr/src/sbin/fsck_ffs/dir.c correctly, the
lost+found/ directory will be created by fsck if it is
required and _not_ present. It will do so on a inode
based method (instead of utilizing a file system oriented
call to make a directory). This is a requirement because
(as you correctly mentioned) the partition checked will
not be writable (or even be mounted), so mkdir() and
related fs functions cannot be used.
Also see an evidence for that idea in "man fsck_ffs".
> 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".
According to "man hier" (mandatory for interpreting the
file system hierarchy on FreeBSD) this your assumption
sounds correct: /mnt is explained to be an "empty directory
commonly used by system administrators as a temporary mount
point", so having a lost+found/ directory in there doesn't
seem to have any purpose and looks wrong.
> So, lost+found dir should exist under root dir as /lost+found.
Correct. It will be assigned to the results of possible
recoveries of lost data of the / partition correctly.
> Any comments before I file a PR request ?
If this directory has been created by the installation
process, I think you should. Maybe you verify the issue
on the freebsd-fs@ list?
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions