summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal LUÇI <eri@pfsense.org>2015-05-27 10:20:52 +0200
committerErmal LUÇI <eri@pfsense.org>2015-05-27 10:50:25 +0200
commitfc123231da1bd74525beddf7948ee8037c47bfe6 (patch)
treefc5d90f8db3e794d901bd1bf6e75f9604e2afaaa /etc
parent9eb84e63210cfd73298160d88387d6345dbe729b (diff)
downloadpfsense-fc123231da1bd74525beddf7948ee8037c47bfe6.zip
pfsense-fc123231da1bd74525beddf7948ee8037c47bfe6.tar.gz
Ticket #4523 Run fsck with -C flag and alway in foreground during bootup to prevent any issues that might schedule background mode.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc109
1 files changed, 36 insertions, 73 deletions
diff --git a/etc/rc b/etc/rc
index 8a76bc9..5340e23 100755
--- a/etc/rc
+++ b/etc/rc
@@ -37,66 +37,24 @@ if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
fi
if [ -e /root/force_fsck ]; then
- echo "Forcing filesystem check..."
- /sbin/fsck -y -t ufs /
- if [ "$PLATFORM" = "nanobsd" ]; then
- /sbin/fsck -y -t ufs /cf
- fi
-fi
-
-if [ "${PLATFORM}" = "nanobsd" ]; then
- kldstat -qm zfs
- if [ $? -eq 0 ]; then
- kldunload zfs
- fi
+ echo "Forcing filesystem(s) check..."
+ /sbin/fsck -y -F -t ufs
fi
-# Mount memory file system if it exists
-echo "Mounting filesystems..."
+if [ ! "${PLATFORM}" = "cdrom" ]; then
+ /sbin/fsck -y -C -F
+ # Mount memory file system if it exists
+ echo "Mounting filesystems..."
-# Handle ZFS read-only case
-if [ "$PLATFORM" = "pfSense" ]; then
- kldstat -qm zfs
- if [ $? -eq 0 ]; then
- ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
- if [ $ZFSFSAVAILABLE -eq 0 ]; then
- kldunload zfs
- elif [ -f /usr/bin/grep ]; then
- ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
- if [ "$ZFSROOT" != "" ]; then
- /sbin/zfs set readonly=off $ZFSROOT
- fi
- fi
- fi
-fi
-
-if [ "${PLATFORM}" = "cdrom" ]; then
- /etc/rc.cdrom
-else
- # Mount /. If it fails run a fsck.
- if [ "$PLATFORM" = "nanobsd" ]; then
- export PKG_TMPDIR=/root/
- /sbin/mount -uw / 2>/dev/null
- mount_rc=$?
- attempts=0
- while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
- /sbin/fsck -y /
- /sbin/fsck -y /cf
- /sbin/mount -uw / 2>/dev/null
- mount_rc=$?
- attempts=$((attempts+1))
- done
- else
+ /sbin/mount -a 2>/dev/null
+ mount_rc=$?
+ attempts=0
+ while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
+ /sbin/fsck -yF /
/sbin/mount -a 2>/dev/null
mount_rc=$?
- attempts=0
- while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
- /sbin/fsck -y /
- /sbin/mount -a 2>/dev/null
- mount_rc=$?
- attempts=$((attempts+1))
- done
- fi
+ attempts=$((attempts+1))
+ done
# If /conf is a directory, convert it to a symlink to /cf/conf
if [ -d "/conf" ]; then
@@ -108,24 +66,6 @@ else
fi
fi
- if [ ! "$PLATFORM" = "jail" ]; then
- # Check to see if a compact flash mountpoint exists
- # If it fails to mount then run a fsck -y
- if grep -q cf /etc/fstab; then
- /sbin/mount -w /cf 2>/dev/null
- /sbin/mount -uw /cf 2>/dev/null
- mount_rc=$?
- attempts=0
- while [ ${mount_rc} -ne 0 -a ${attempts} -lt 3 ]; do
- /sbin/umount /cf
- /sbin/fsck -y /cf
- /sbin/mount -w /cf 2>/dev/null
- mount_rc=$?
- attempts=$((attempts+1))
- done
- fi
- fi
-
USE_MFS_TMPVAR=`/usr/bin/grep -c use_mfs_tmpvar /cf/conf/config.xml`
if [ "${PLATFORM}" = "nanobsd" ] || [ ${USE_MFS_TMPVAR} -gt 0 ]; then
/etc/rc.embedded
@@ -136,6 +76,29 @@ fi
/bin/rm -f /root/TRIM_set
/bin/rm -f /root/TRIM_unset
+if [ "${PLATFORM}" = "nanobsd" ]; then
+ /sbin/kldstat -qm zfs
+ if [ $? -eq 0 ]; then
+ /sbin/kldunload zfs
+ fi
+elif [ "$PLATFORM" = "pfSense" ]; then
+ # Handle ZFS read-only case
+ /sbin/kldstat -qm zfs
+ if [ $? -eq 0 ]; then
+ ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
+ if [ $ZFSFSAVAILABLE -eq 0 ]; then
+ /sbin/kldunload zfs
+ elif [ -f /usr/bin/grep ]; then
+ ZFSROOT=`/sbin/zfs mount | /usr/bin/grep ' /$' | /usr/bin/cut -d ' ' -f 1`
+ if [ "$ZFSROOT" != "" ]; then
+ /sbin/zfs set readonly=off $ZFSROOT
+ fi
+ fi
+ fi
+elif [ "${PLATFORM}" = "cdrom" ]; then
+ /etc/rc.cdrom
+fi
+
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles.
if [ -f /etc/rc.disable_hdd_apm ]; then
/etc/rc.disable_hdd_apm
OpenPOWER on IntegriCloud