Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 2013 16:25:52 +0200
From:      Anton Sayetsky <vsjcfm@gmail.com>
To:        Antonio Kless <antoniok.spb@gmail.com>,  FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Avoid to run `fsck` twice (and save some time during boot)
Message-ID:  <CAFG2KCLbWkdhVPi-f8X7S1B7D82Kn4-h8Kcn3-9H4gwNGZQeew@mail.gmail.com>
In-Reply-To: <52AB1791.6090508@gmail.com>
References:  <52AB1791.6090508@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2013/12/13 Antonio Kless <antoniok.spb@gmail.com>:
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFG2KCLbWkdhVPi-f8X7S1B7D82Kn4-h8Kcn3-9H4gwNGZQeew>