Avoid to run `fsck` twice (and save some time during boot)
Anton Sayetsky
vsjcfm at gmail.com
Fri Dec 13 14:26:15 UTC 2013
2013/12/13 Antonio Kless <antoniok.spb at 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
More information about the freebsd-questions
mailing list