lost+found dir placement

2012-03-13 Thread jb
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.

Any comments before I file a PR request ?
jb


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: lost+found dir placement

2012-03-13 Thread Adam Vande More
On Tue, Mar 13, 2012 at 2:58 AM, jb jb.1234a...@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.

 Any comments before I file a PR request ?
 jb


The directory is created in the top of the filesystem, so you should check
what is mounted on /mnt.

Filesystem Hierarchy Standard --  This is a Linux standard.  For info on
FreeBSD hierarchy see man hier(7)

-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: lost+found dir placement

2012-03-13 Thread Polytropon
On Tue, 13 Mar 2012 07:58:09 + (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, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: lost+found dir placement

2012-03-13 Thread Robert Bonomi

jb jb.1234a...@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.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org