summaryrefslogtreecommitdiffstats
path: root/src/etc/pfSense-rc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-12 11:37:54 -0200
committerRenato Botelho <renato@netgate.com>2017-01-12 11:37:54 -0200
commitcc82c3288dd551a0e34ed827d8b3523ba2bdf07f (patch)
treeb69fcbcc8c61144b0c8c8683ff68ac64206d160a /src/etc/pfSense-rc
parentad9548b267ad533773ebc80e9ef23dbd6d0f9281 (diff)
downloadpfsense-cc82c3288dd551a0e34ed827d8b3523ba2bdf07f.zip
pfsense-cc82c3288dd551a0e34ed827d8b3523ba2bdf07f.tar.gz
Ticket #6340:
- Stop misusing fsck -F parameter, it's supposed to be used when you plan to run background fsck after filesystems are mounted, what is not the case on pfSense - Increase attempts to mount all filesystems as read-write to 10 - If we cannot mount filesystems as read-write, start a recovery shell and after it finishes, reboot system
Diffstat (limited to 'src/etc/pfSense-rc')
-rwxr-xr-xsrc/etc/pfSense-rc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc
index 2bc0ab8..83e1518 100755
--- a/src/etc/pfSense-rc
+++ b/src/etc/pfSense-rc
@@ -64,7 +64,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/fsck -y -F -t ufs
+ /sbin/fsck -y -t ufs
fsck_forced_iterations=$((fsck_forced_iterations - 1))
done
fi
@@ -74,7 +74,7 @@ if [ -e /root/force_growfs ]; then
fi
FSCK_ACTION_NEEDED=0
-/sbin/fsck -p -F
+/sbin/fsck -p
case $? in
0)
echo "Filesystems are clean, continuing..."
@@ -92,19 +92,25 @@ esac
if [ ${FSCK_ACTION_NEEDED} = 1 ]; then
echo "WARNING: Trying to recover filesystem from inconsistency..."
- /sbin/fsck -yF
+ /sbin/fsck -y -t ufs
fi
/sbin/mount -a 2>/dev/null
mount_rc=$?
attempts=0
-while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
- /sbin/fsck -yF
+while [ ${mount_rc} -ne 0 -a ${attempts} -lt 10 ]; do
+ /sbin/fsck -y -t ufs
/sbin/mount -a 2>/dev/null
mount_rc=$?
attempts=$((attempts+1))
done
+if [ ${mount_rc} -ne 0 ]; then
+ echo "ERROR: Impossible to mount filesystem, use interactive shell to attempt to recover it"
+ /bin/sh
+ /sbin/reboot
+fi
+
# Handle ZFS read-only case
/sbin/kldstat -qm zfs
if [ $? -eq 0 ]; then
OpenPOWER on IntegriCloud