summaryrefslogtreecommitdiffstats
path: root/etc/rc
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2014-04-17 20:19:29 +0000
committerErmal <eri@pfsense.org>2014-04-17 20:19:29 +0000
commit302c005e1123add037411c30e035d5d715b51424 (patch)
tree2df66b151c74336525e20d386aede94938dac8cf /etc/rc
parentc93f46fea402a3d593e0418d8105948beabfca38 (diff)
downloadpfsense-302c005e1123add037411c30e035d5d715b51424.zip
pfsense-302c005e1123add037411c30e035d5d715b51424.tar.gz
Unload the ZFS module if its not in use to not consume uselss memory
Diffstat (limited to 'etc/rc')
-rwxr-xr-xetc/rc22
1 files changed, 18 insertions, 4 deletions
diff --git a/etc/rc b/etc/rc
index c8d1a8e..1990e40 100755
--- a/etc/rc
+++ b/etc/rc
@@ -39,15 +39,29 @@ if [ -e /root/force_fsck ]; then
fi
fi
+if [ "${PLATFORM}" = "nanobsd" ]; then
+ kldstat -qm zfs
+ if [ $? = 0 ]; then
+ kldunload zfs
+ fi
+fi
+
# Mount memory file system if it exists
echo "Mounting filesystems..."
+kldstat -qm zfs
# Handle ZFS read-only case
if [ "$PLATFORM" = "pfSense" ]; then
- if [ -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
+ kldstat -qm zfs
+ if [ $? = 0 ]; then
+ ZFSFSAVAILABLE=$(/sbin/zfs mount 2>/dev/null | wc -l)
+ if [ $ZFSAVAILABLE -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
OpenPOWER on IntegriCloud