From owner-freebsd-questions@FreeBSD.ORG Fri Dec 13 14:26:15 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 141407E3 for ; Fri, 13 Dec 2013 14:26:15 +0000 (UTC) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [IPv6:2607:f8b0:400c:c01::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C78E81D7A for ; Fri, 13 Dec 2013 14:26:14 +0000 (UTC) Received: by mail-ve0-f172.google.com with SMTP id jw12so1411769veb.17 for ; Fri, 13 Dec 2013 06:26:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Da92TJT8aSwiQWcZLovRrvQk8MKb8NxegtmgNWdT8tc=; b=k8z9Yltv6sihctMaARUiyYsACza0ty64HNPM3xj73wkczJFl9OUY2CCEmON1kmfzTc rRK0bqqet5ic00/seeOetzbS47ivHZuNdtKMnAJELHr8a9x/4pQo+NICEmEj4TNKqydA OF17DPA512K6W7FfojGOBgUur1rU1rOMEmz20Wm1FYedv2EZBCSiIWmYYNrjqdlRORL1 091AztPrK983cGTGoDESQ2h7n7ti5FbVYaRDPRW3WvxAeaeRXKx7nKKfDbspg9kuozqY 2W9OTNwX28ixbrfpunZKD10N/j2WqegHGiCbxxiU+i7JfsEjEyLUICUeYsJrp4rbVc/V EZew== X-Received: by 10.52.75.99 with SMTP id b3mr158347vdw.80.1386944773703; Fri, 13 Dec 2013 06:26:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.58.231.167 with HTTP; Fri, 13 Dec 2013 06:25:52 -0800 (PST) In-Reply-To: <52AB1791.6090508@gmail.com> References: <52AB1791.6090508@gmail.com> From: Anton Sayetsky Date: Fri, 13 Dec 2013 16:25:52 +0200 Message-ID: Subject: Re: Avoid to run `fsck` twice (and save some time during boot) To: Antonio Kless , FreeBSD Questions Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Dec 2013 14:26:15 -0000 2013/12/13 Antonio Kless : > I am running 8.4-RELEASE-p4 (amd64) box with this lines in /etc/rc.conf: > > fsck_y_enable="YES" > background_fsck="NO" > > - to be sure that if it will be rebooted with power loss, filesystem > would be checked and repaired. > > But I discovered (/etc/rc.d/fsck) that `fsck` run twice: > > fsck_start() > { > if [ "$autoboot" = no ]; then > echo "Fast boot: skipping disk checks." > elif [ ! -r /etc/fstab ]; then > echo "Warning! No /etc/fstab: skipping disk checks." > elif [ "$autoboot" = yes ]; then > # During fsck ignore SIGQUIT > trap : 3 > > check_startmsgs && echo "Starting file system checks:" > if checkyesno background_fsck; then > fsck -F -p > else > fsck -p > fi > > case $? in > > ..... > > 8) > if checkyesno fsck_y_enable; then > echo "File system preen failed, trying fsck -y ${fsck_y_flags}" > fsck -y ${fsck_y_flags} > case $? in > 0) > ;; > *) > echo "Automatic file system check failed; help!" > stop_boot > ;; > esac > else > echo "Automatic file system check failed; help!" > stop_boot > fi > ;; > > ..... > > > So time is wasting. Why not just run `fsck -y ${fsck_y_flags}`? > > Of course I could hack the script, but I wonder if there is the way to > avoid runnig fsck twice not hacking system scripts? Or is there any > reasons to run it twice? man fsck /-p ... profit