Bug 19001

Summary: Delayed fsck + mount of insignificant filesystems.
Product: Base System Reporter: Poul-Henning Kamp <phk>
Component: confAssignee: Poul-Henning Kamp <phk>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description Poul-Henning Kamp 2000-06-04 21:50:00 UTC
	Many of the machines I administer have large but relatively
	inconsequential filesystems.

	It would be nice if they could be marked in /etc/fstab for
	"later fsck + mount" so that a lengthy fsck of these
	filesysetms does not hold up the rest of the boot process.

	If a small script were provided, along with a freeform string
	tag in /etc/fstab, one could fsck/mount the squid cache partitions
	right before squid is started with:
		/etc/rc.mount squid
	and news partitions right before inn with
		/etc/rc.mount news

	Further to this it should be possible to specify a "not important"
	flag so that if the fsck/mount doesn't succeed we just continue
	without the filesystem, rather than drop into single-user.
Comment 1 Chris Dillon 2000-06-04 23:59:32 UTC
On Sun, 4 Jun 2000, Poul-Henning Kamp wrote:

> >Description:
> 
> 	Many of the machines I administer have large but relatively
> 	inconsequential filesystems.
> 
> 	It would be nice if they could be marked in /etc/fstab for
> 	"later fsck + mount" so that a lengthy fsck of these
> 	filesysetms does not hold up the rest of the boot process.

I agree, this would be very helpful, especially if said system also
performed other important functions that would otherwise take much
longer to resume if these large filesystems had to be fsck'd
first.  This of course will become moot once our filesystems no longer
need to be fsck'd.

> 	If a small script were provided, along with a freeform string
> 	tag in /etc/fstab, one could fsck/mount the squid cache partitions
> 	right before squid is started with:
> 		/etc/rc.mount squid
> 	and news partitions right before inn with
> 		/etc/rc.mount news

I think this could be done with absolutely no changes to the fstab
format or any of the existing utilities.  You could simply add the
'noauto' option and a pass number of 0 to keep them from being fsck'd
and mounted at boot time, and then add a comment to the end of the
line tagging them so that a script could fsck and mount them later.

/dev/da0s1g             /cache.0        ufs     rw,noatime,noauto 0 0 #squid
/dev/da1s1g             /cache.1        ufs     rw,noatime,noauto 0 0 #squid
/dev/da2s1g             /cache.2        ufs     rw,noatime,noauto 0 0 #squid

And the script could look something like this:

#!/bin/sh
for arg in $*; do
        filesystems=`grep "#${arg}" /etc/fstab | awk -F ' ' '{ print $2; }' | xargs echo`
        for filesystem in $filesystems; do
                fsck -p $filesystem && mount $filesystem
        done

I'm sure it could be done more elegantly, but I whipped that up
quickly.

> 	Further to this it should be possible to specify a "not important"
> 	flag so that if the fsck/mount doesn't succeed we just continue
> 	without the filesystem, rather than drop into single-user.

This would be accomplished with what I have above, since 'noauto'
assumes as much.  You could add a way to log a fsck or mount failure
in the script via logger(1) or something like that.


-- Chris Dillon - cdillon@wolves.k12.mo.us - cdillon@inter-linc.net
   FreeBSD: The fastest and most stable server OS on the planet.
   For Intel x86 and Alpha architectures. ( http://www.freebsd.org )
Comment 2 ashp freebsd_committer freebsd_triage 2002-02-09 19:33:18 UTC
State Changed
From-To: open->feedback

Recently background fscks were introduced in -CURRENT.  Does 
this potentially help with this problem?  While I'm not sure 
that they will get merged back into STABLE, they will be 
available in FreeBSD 5.0+.
Comment 3 Jens Schweikhardt freebsd_committer freebsd_triage 2002-08-13 22:10:28 UTC
Responsible Changed
From-To: freebsd-bugs->phk

Poul-Henning: if any of the proposed solutions do the trick for you, 
please feel free to close this PR. I don't want to timeout you :-)
Comment 4 Poul-Henning Kamp freebsd_committer freebsd_triage 2002-08-15 09:59:03 UTC
State Changed
From-To: feedback->closed

OBE:  background FSCK is good enough for me.