Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2006 10:29:30 -0600
From:      Eric Anderson <anderson@centtech.com>
To:        Ensel Sharon <user@dhp.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: please help - explanation for odd fsck times/behavior needed
Message-ID:  <4416EF6A.3020201@centtech.com>
In-Reply-To: <Pine.LNX.4.21.0603141059060.8684-100000@shell.dhp.com>
References:  <Pine.LNX.4.21.0603141059060.8684-100000@shell.dhp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ensel Sharon wrote:
> System is FreeBSD 6.0-RELEASE with a 400gig data partition, mounted at
> /data.  I am using snapshots on that partition.
>
> Whenever the system crashes, it comes up very quickly, and launches a
> background fsck of /data.  Since this would take a long time, and I don't
> want people using the system at a decreased performance, I always kill the
> background fsck, comment out the filesystem in /etc/fstab, reboot the
> system, and when it comes up fsck it in the foreground.  It always takes 2
> hours.  Always.
>
> So I decide that instead of doing the little boot, kill bg_fsck, comment
> out, reboot dance, I will just set background_fsck="NO" in rc.conf, and
> now I will just fsck in the foreground immediately after crashes.  But it
> is not working that way.
>
> Now what I see is:
>
> - system takes 20-30 minutes to come up
> - when system does come up, /data is _mounted_
> - /data is in fact dirty
> - if I unmount /data and fsck it, it only takes 15 minutes to fsck
>
> So I really don't get it - especially the last two items.  Why would the
> system mount /data dirty if it had no plans to background fsck it ?
>
> The only theory I have is this:
>
> - the boot takes a lot longer because it is fscking / and /var, NOT in the
> background, and it has to wait to boot until that is finished.
>
> - the foreground fsck of /data always took two hours before, because it
> was also fsck'ing / and /var at the same time
>
> - now that / and /var get fsck'd in the foreground before going
> multi-user, it only takes 15 minutes to fsck /data
>
>
> Is this ^^^ correct ?  I still don't get the logic behind mounting /data
> dirty though ... is there any way to specify "fsck / and /var. and go
> multi-user, but don't mount any other partitions unless they are clean" ?


First, this is how I have a system set up with similar characteristics 
as yours.  I have these options in rc.conf:

background_fsck="NO"
fsck_y_enable="YES"

and my fstab looks like:

/dev/devicename   /mntpoint      ufs   rw,otheroptions      0   2

So, when my system goes down unclean, and I boot back up, all the 
filesystems will be fsck'ed, starting with root, then var, then my other 
mount points, in order of the pass number in the fstab (above, mine is 
set to 2).  You should have root 1, then var 2, and other partitions 
3,4, etc probably.

If you are using softupdates with UFS2, which presumably you are, then 
you can do background fsck's, and mount the dirty partition and begin 
using the filesystem before fsck's start.  This works by mounting the 
filesystem, then 60 seconds later (configurable), beginning a bgfsck.  
Before the background fsck can start, it must take a snapshot of the 
filesystem to run against.  That alone can take 1-2 hours, depending on 
filesystem size and how full it is, and how busy it is.  Because of that 
time delay, I prefer to do foreground fsck's.


Eric



-- 
------------------------------------------------------------------------
Eric Anderson        Sr. Systems Administrator        Centaur Technology
Anything that works is better than anything that doesn't.
------------------------------------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4416EF6A.3020201>