mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Mount the disk (the root slice) as read-only before running the fsck in the preen mode.
This force the flush of all pending writes to disk and thus put the disk in a consistent state. The second effect of this change is that the file system can actually be recovered now, because otherwise with the root slice mounted as read-write, the fsck cannot write any changes.
This commit is contained in:
parent
2448d0fc1f
commit
286cd23124
@ -69,6 +69,7 @@ fsck_forced_iterations=`/bin/kenv -q pfsense.fsck.force`
|
||||
if [ ! -z "${fsck_forced_iterations}" ]; then
|
||||
echo "Forcing filesystem check (${fsck_forced_iterations} times)..."
|
||||
while [ ${fsck_forced_iterations} -gt 0 ]; do
|
||||
/sbin/mount -ur /
|
||||
/sbin/fsck -y -t ufs
|
||||
fsck_forced_iterations=$((fsck_forced_iterations - 1))
|
||||
done
|
||||
@ -78,6 +79,12 @@ if [ -e /root/force_growfs ]; then
|
||||
/etc/rc.d/growfs onestart
|
||||
fi
|
||||
|
||||
#
|
||||
# The file system needs to be unmounted to guarantee a clean operation of fsck.
|
||||
# Pending changes can keep the file system dirty until all the cached data is
|
||||
# flushed to the disk.
|
||||
#
|
||||
/sbin/mount -ur /
|
||||
FSCK_ACTION_NEEDED=0
|
||||
/sbin/fsck -p
|
||||
case $? in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user