Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2012 09:11:41 +0100
From:      Polytropon <freebsd@edvax.de>
To:        jb <jb.1234abcd@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: lost+found dir placement
Message-ID:  <20120313091141.11263aeb.freebsd@edvax.de>
In-Reply-To: <loom.20120313T085550-787@post.gmane.org>
References:  <loom.20120313T085550-787@post.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 13 Mar 2012 07:58:09 +0000 (UTC), jb wrote:
> Hi,
> 
> Each fs should have its own lost+found directory.
> It is used by fsck for placing recovered corrupted fs files in there.

Correct.



> 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?



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120313091141.11263aeb.freebsd>