From nobody@FreeBSD.org  Tue Jun  8 10:48:10 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD41E106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  8 Jun 2010 10:48:10 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id ACE858FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  8 Jun 2010 10:48:10 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o58AmA1J018317
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 8 Jun 2010 10:48:10 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o58Am9sA018316;
	Tue, 8 Jun 2010 10:48:09 GMT
	(envelope-from nobody)
Message-Id: <201006081048.o58Am9sA018316@www.freebsd.org>
Date: Tue, 8 Jun 2010 10:48:09 GMT
From: Alex Keda <admin@lissyara.su>
To: freebsd-gnats-submit@FreeBSD.org
Subject: new feature for /etc/rc.d/fsck
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147685
>Category:       conf
>Synopsis:       [rc.d] [patch] new feature for /etc/rc.d/fsck
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 08 10:50:01 UTC 2010
>Closed-Date:    
>Last-Modified:  Wed Jun  9 05:30:01 UTC 2010
>Originator:     Alex Keda
>Release:        9.0-CURRENT
>Organization:
USSR
>Environment:
FreeBSD lissyara.moskb.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r208900: Tue Jun  8 08:46:18 MSD 2010     root@lissyara.moskb.local:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
We have many servers located in datacenters. These difficult physical access. After several years of work, unexpected reboot (power problems, panic, ....) on the file system with errors. Not all file system may check and fix remotely - /, / usr can not unmount at work.

This patch allows you to schedule a scan file systems at boot time, before they are mounted.
>How-To-Repeat:

>Fix:
see attached patch

Patch attached with submission follows:

--- /tmp/fsck.orig	2010-06-08 14:17:59.000000000 +0400
+++ /etc/rc.d/fsck	2010-06-08 14:18:24.000000000 +0400
@@ -27,7 +27,16 @@
 		if checkyesno background_fsck; then
 			fsck -F -p
 		else
-			fsck -p
+			if checkyesno force_fsck; then
+				echo "Force fsck enabled"
+				for filesystem in ${force_fsck_list}
+				do
+					echo "Force check $filesystem"
+					fsck -y $filesystem
+				done
+			else
+				fsck -p
+			fi
 		fi
 
 		case $? in
--- /tmp/rc.conf	2010-06-08 14:36:52.000000000 +0400
+++ /etc/defaults/rc.conf	2010-06-08 14:38:55.000000000 +0400
@@ -87,6 +87,9 @@
 fsck_y_flags=""		# Additional flags for fsck -y
 background_fsck="YES"	# Attempt to run fsck in the background where possible.
 background_fsck_delay="60" # Time to wait (seconds) before starting the fsck.
+force_fsck="NO"		# force check filesystems on startup
+force_fsck_list=""	# list file systems for force check on startup
+#force_fsck_list="/ /usr /var"
 netfs_types="nfs:NFS nfs4:NFS4 smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems.
 extra_netfs_types="NO"	# List of network extra filesystem types for delayed
 			# mount at startup (or NO).


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yanefbsd@gmail.com>
To: Alex Keda <admin@lissyara.su>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: misc/147685: new feature for /etc/rc.d/fsck
Date: Tue, 8 Jun 2010 03:58:31 -0700

 Alex,
 
 Have you tried fsck_y_enable ?
 
      fsck_y_enable
                  (bool) If set to ``YES'', fsck(8) will be run with the -y
                  flag if the initial preen of the file systems fails.
 
 Thanks,
 -Garrett

From: Alex Keda <admin@lissyara.su>
To: Garrett Cooper <yanefbsd@gmail.com>, bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/147685: new feature for /etc/rc.d/fsck
Date: Tue, 08 Jun 2010 15:09:26 +0400

 yes. but, background_fsck="YES" (set by default) mark file systems as 
 clean, but sometimes it have some errors after check it.
 without background_fsck - filesystem with size 1-2T may check 
 very-very-very long time...
 with it feature server administrator can planning downtime at night, for 
 example.
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue Jun 8 16:16:40 UTC 2010 
Responsible-Changed-Why:  
Reassign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147685 

From: Brian Somers <brian@Awfulhak.org>
To: Alex Keda <admin@lissyara.su>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: misc/147685: new feature for /etc/rc.d/fsck
Date: Tue, 8 Jun 2010 22:12:05 -0700

 On Tue, 8 Jun 2010 10:48:09 GMT Alex Keda <admin@lissyara.su> wrote:
 > 
 > >Number:         147685
 > >Category:       misc
 > >Synopsis:       new feature for /etc/rc.d/fsck
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          update
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Tue Jun 08 10:50:01 UTC 2010
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Alex Keda
 > >Release:        9.0-CURRENT
 > >Organization:
 > USSR
 > >Environment:
 > FreeBSD lissyara.moskb.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r208900: Tue Jun  8 08:46:18 MSD 2010     root@lissyara.moskb.local:/usr/obj/usr/src/sys/GENERIC  amd64
 > >Description:
 > We have many servers located in datacenters. These difficult physical access. After several years of work, unexpected reboot (power problems, panic, ....) on the file system with errors. Not all file system may check and fix remotely - /, / usr can not unmount at work.
 > 
 > This patch allows you to schedule a scan file systems at boot time, before they are mounted.
 > >How-To-Repeat:
 > 
 > >Fix:
 > see attached patch
 > 
 > Patch attached with submission follows:
 > 
 > --- /tmp/fsck.orig	2010-06-08 14:17:59.000000000 +0400
 > +++ /etc/rc.d/fsck	2010-06-08 14:18:24.000000000 +0400
 > @@ -27,7 +27,16 @@
 >  		if checkyesno background_fsck; then
 >  			fsck -F -p
 >  		else
 > -			fsck -p
 > +			if checkyesno force_fsck; then
 > +				echo "Force fsck enabled"
 > +				for filesystem in ${force_fsck_list}
 > +				do
 > +					echo "Force check $filesystem"
 > +					fsck -y $filesystem
 > +				done
 > +			else
 > +				fsck -p
 > +			fi
 >  		fi
 >  
 >  		case $? in
 > --- /tmp/rc.conf	2010-06-08 14:36:52.000000000 +0400
 > +++ /etc/defaults/rc.conf	2010-06-08 14:38:55.000000000 +0400
 > @@ -87,6 +87,9 @@
 >  fsck_y_flags=""		# Additional flags for fsck -y
 >  background_fsck="YES"	# Attempt to run fsck in the background where possible.
 >  background_fsck_delay="60" # Time to wait (seconds) before starting the fsck.
 > +force_fsck="NO"		# force check filesystems on startup
 > +force_fsck_list=""	# list file systems for force check on startup
 > +#force_fsck_list="/ /usr /var"
 >  netfs_types="nfs:NFS nfs4:NFS4 smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems.
 >  extra_netfs_types="NO"	# List of network extra filesystem types for delayed
 >  			# mount at startup (or NO).
 > 
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 
 This patch will avoid running fsck -p, so filesystems not in $force_fsck_list
 will miss out.
 
 Personally I'd prefer to see a feature like this integrated with nextboot(8)
 and handled on a once-only basis before the fsck -p.  Although nextboot
 currently only handles kernel boot info, it seems the right place for this
 feature.
 
     nextboot -c / -c /usr
 
 would force fsck of both / and /usr, then remove the configuration so that
 a subsequent reboot would not force the same fsck again.
 
 What do you think?
 
 -- 
 Brian Somers                                          <brian@Awfulhak.org>
 Don't _EVER_ lose your sense of humour !               <brian@FreeBSD.org>
>Unformatted:
