Skip to content

Commit

Permalink
rc: allow to disable trim for the brave
Browse files Browse the repository at this point in the history
Requires fiddling with /etc/fstab, at least that is a file
that we never touch.  It's harder for installs that need
TRIM to be off all the time as the first boot does actually
enable it.  That means after the install is complete it needs
to be CTRL+C'ed and the fstab entry modified before reboot.

PR: https://forum.opnsense.org/index.php?topic=3044
  • Loading branch information
fichtner committed May 23, 2016
1 parent 39eed8a commit 68d539a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/etc/rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ while read FS_PART FS_MNT FS_TYPE FS_MORE; do
FS_DEV=$(echo ${FS_PART} | awk 'match($0, /\/dev\/([a-z]+[0-9]+)/) { print substr( $0, RSTART, RLENGTH )}')
FS_TRIM=$(camcontrol identify ${FS_DEV} | grep TRIM | awk '{ print $5; }')
if [ "${FS_TRIM}" = "yes" ]; then
tunefs -t enable ${FS_MNT}
# appending "# notrim" to the /etc/fstab entry
# will allow to strip trim and leave it disabled
if echo "${FS_MORE}" | grep -iq notrim; then
tunefs -t disable ${FS_MNT}
else
tunefs -t enable ${FS_MNT}
fi
fi
done < /etc/fstab

Expand Down

0 comments on commit 68d539a

Please sign in to comment.