summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-02-02 21:30:31 -0500
committerjim-p <jimp@pfsense.org>2013-02-02 21:30:31 -0500
commit2085c6de5de1d9cd8864f85628f775bce5853012 (patch)
tree5072f11948de31c08ef1f3ff3c1b90105412211e /etc
parent8fd76a0704f514498bfdb7eca73a3bcd69dcda96 (diff)
downloadpfsense-2085c6de5de1d9cd8864f85628f775bce5853012.zip
pfsense-2085c6de5de1d9cd8864f85628f775bce5853012.tar.gz
Add a manual way for someone to set TRIM if they really want it. touch /root/TRIM_set and reboot to set, touch /root/TRIM_unset to clear.
Have to reboot after setting the tunefs flag or when mount is run, it clears any changes. No way to do it on the fly.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc24
1 files changed, 24 insertions, 0 deletions
diff --git a/etc/rc b/etc/rc
index ca9af7f..07ab210 100755
--- a/etc/rc
+++ b/etc/rc
@@ -31,6 +31,27 @@ if [ "$PLATFORM" = "pfSense" ]; then
/etc/rc.dumpon
fi
+TUNEFS_STATUS=`/sbin/tunefs -p / 2>&1 | /usr/bin/grep trim: | /usr/bin/awk '{print $4;}'`
+if [ -e /root/TRIM_set ] && [ "${TUNEFS_STATUS}" = "disabled" ]; then
+ echo "Enabling TRIM support"
+ /sbin/tunefs -t enable /
+ if [ "$PLATFORM" = "nanobsd" ]; then
+ /sbin/tunefs -t enable /cf
+ fi
+ echo "Rebooting in 5 seconds after enabling TRIM..."
+ sleep 5
+ /sbin/reboot
+elif [ -e /root/TRIM_unset ] && [ "${TUNEFS_STATUS}" = "enabled" ]; then
+ echo "Disabling TRIM support"
+ /sbin/tunefs -t disable /
+ if [ "$PLATFORM" = "nanobsd" ]; then
+ /sbin/tunefs -t disable /cf
+ fi
+ echo "Rebooting in 5 seconds after disabling TRIM..."
+ sleep 5
+ /sbin/reboot
+fi
+
# Mount memory file system if it exists
echo "Mounting filesystems..."
@@ -76,6 +97,9 @@ if [ ! "$PLATFORM" = "cdrom" ] ; then
fi
fi
+/bin/rm -f /root/TRIM_set
+/bin/rm -f /root/TRIM_unset
+
# 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