Revision 2085c6de
Added by Jim Pingle over 12 years ago
etc/rc | ||
---|---|---|
31 | 31 |
/etc/rc.dumpon |
32 | 32 |
fi |
33 | 33 |
|
34 |
TUNEFS_STATUS=`/sbin/tunefs -p / 2>&1 | /usr/bin/grep trim: | /usr/bin/awk '{print $4;}'` |
|
35 |
if [ -e /root/TRIM_set ] && [ "${TUNEFS_STATUS}" = "disabled" ]; then |
|
36 |
echo "Enabling TRIM support" |
|
37 |
/sbin/tunefs -t enable / |
|
38 |
if [ "$PLATFORM" = "nanobsd" ]; then |
|
39 |
/sbin/tunefs -t enable /cf |
|
40 |
fi |
|
41 |
echo "Rebooting in 5 seconds after enabling TRIM..." |
|
42 |
sleep 5 |
|
43 |
/sbin/reboot |
|
44 |
elif [ -e /root/TRIM_unset ] && [ "${TUNEFS_STATUS}" = "enabled" ]; then |
|
45 |
echo "Disabling TRIM support" |
|
46 |
/sbin/tunefs -t disable / |
|
47 |
if [ "$PLATFORM" = "nanobsd" ]; then |
|
48 |
/sbin/tunefs -t disable /cf |
|
49 |
fi |
|
50 |
echo "Rebooting in 5 seconds after disabling TRIM..." |
|
51 |
sleep 5 |
|
52 |
/sbin/reboot |
|
53 |
fi |
|
54 |
|
|
34 | 55 |
# Mount memory file system if it exists |
35 | 56 |
echo "Mounting filesystems..." |
36 | 57 |
|
... | ... | |
76 | 97 |
fi |
77 | 98 |
fi |
78 | 99 |
|
100 |
/bin/rm -f /root/TRIM_set |
|
101 |
/bin/rm -f /root/TRIM_unset |
|
102 |
|
|
79 | 103 |
# Disable APM on ATA drives. Leaving this on will kill drives long-term, especially laptop drives, by generating excessive Load Cycles. |
80 | 104 |
if [ -f /etc/rc.disable_hdd_apm ]; then |
81 | 105 |
/etc/rc.disable_hdd_apm |
Also available in: Unified diff
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.