diff options
author | Ermal <eri@pfsense.org> | 2014-04-17 20:19:29 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-04-17 20:19:29 +0000 |
commit | 302c005e1123add037411c30e035d5d715b51424 (patch) | |
tree | 2df66b151c74336525e20d386aede94938dac8cf /etc/rc | |
parent | c93f46fea402a3d593e0418d8105948beabfca38 (diff) | |
download | pfsense-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-x | etc/rc | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -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 |