summaryrefslogtreecommitdiffstats
path: root/src/etc/pfSense-rc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-19 16:54:50 -0200
committerRenato Botelho <renato@netgate.com>2017-01-19 16:55:04 -0200
commitfcf164d623f672f2f37a2da7b4b02fbcedbcfe23 (patch)
treec9f98b740bef43905d587d7163ca97b6416d3667 /src/etc/pfSense-rc
parent5760245897516f17f50c699cf3770ca78f5af473 (diff)
downloadpfsense-fcf164d623f672f2f37a2da7b4b02fbcedbcfe23.zip
pfsense-fcf164d623f672f2f37a2da7b4b02fbcedbcfe23.tar.gz
Make sure all ZFS volumes are mounted during boot and only mount /var and /tmp when MFS is disabled. Fixes #7086
Diffstat (limited to 'src/etc/pfSense-rc')
-rwxr-xr-xsrc/etc/pfSense-rc24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc
index 9b80eae..19b8928 100755
--- a/src/etc/pfSense-rc
+++ b/src/etc/pfSense-rc
@@ -112,16 +112,18 @@ if [ ${mount_rc} -ne 0 ]; then
fi
# Handle ZFS read-only case
-/sbin/kldstat -qm zfs
-if [ $? -eq 0 ]; then
+unset USE_ZFS
+if /sbin/kldstat -qm zfs; 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
+ else
+ USE_ZFS=1
+ ZFSROOT=$(/sbin/zfs mount | /usr/bin/awk '$2 == "/" {print $1}')
+ if [ -n "$ZFSROOT" ]; then
/sbin/zfs set readonly=off $ZFSROOT
fi
+ /sbin/zfs mount -a
fi
fi
@@ -136,6 +138,18 @@ if [ -d "/conf" ]; then
fi
USE_MFS_TMPVAR=$(/usr/local/sbin/read_xml_tag.sh boolean system/use_mfs_tmpvar)
+
+# Mount /var and /tmp on ZFS filesystems when it's necessary
+if [ -n "${USE_ZFS}" -a "${USE_MFS_TMPVAR}" != "true" ]; then
+ zfs list -H -o name,mountpoint,canmount |
+ while read volume mountpoint canmount; do
+ [ "${mountpoint}" != "/var" -a "${mountpoint}" != "/tmp" ] \
+ && continue
+
+ /sbin/zfs mount ${volume}
+ done
+fi
+
unset MOVE_PKG_DATA
# If use MFS var is disabled, move files back to place
if [ "${USE_MFS_TMPVAR}" != "true" -a -f /root/var/db/pkg/local.sqlite ]; then
OpenPOWER on IntegriCloud