Avoid to run `fsck` twice (and save some time during boot)

Antonio Kless antoniok.spb at gmail.com
Fri Dec 13 14:20:14 UTC 2013


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?

-- 
Best regards,
Antonio Kless


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20131213/2750a59a/attachment.sig>


More information about the freebsd-questions mailing list