Add fsck_flags config option

On UFS with SU+J, sometimes fsck's default recovery from journal marks the
filesystem as clean but some errors remain.

With SU only, default fsck in preen mode sometimes thinks all errors have
been fixed but some still remain.

To address the issues above, this change adds a new config option:
fsck_flags.  By default it's set to -p, but the user may change it to -y
or -f -y, for instance, to force a full fsck after a system crash.

Submitted by:	jhibbits@ (original version)
Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D24087
This commit is contained in:
Leandro Lupori 2020-03-18 13:09:47 +00:00
parent d80eccfc98
commit e9f87d29a8
2 changed files with 5 additions and 2 deletions

View File

@ -101,6 +101,7 @@ geli_autodetach="YES" # Automatically detach on last close.
root_rw_mount="YES" # Set to NO to inhibit remounting root read-write.
root_hold_delay="30" # Time to wait for root mount hold release.
fsck_flags="-p" # May be changed to -f (or -f -y) to force a full fsck
fsck_y_enable="NO" # Set to YES to do fsck -y if the initial preen fails.
fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y
background_fsck="YES" # Attempt to run fsck in the background where possible.

View File

@ -25,10 +25,11 @@ fsck_start()
trap : 3
check_startmsgs && echo "Starting file system checks:"
# Background fsck can only be run with -p
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
fsck ${fsck_flags}
fi
err=$?
@ -37,10 +38,11 @@ fsck_start()
"available; retrying"
root_hold_wait
check_startmsgs && echo "Restarting file system checks:"
# Background fsck can only be run with -p
if checkyesno background_fsck; then
fsck -F -p
else
fsck -p
fsck ${fsck_flags}
fi
err=$?
fi