Commit 67e49aba authored by Franco Fichtner's avatar Franco Fichtner

rc: enable TRIM for GPT/UFS labels too; closes #1055

parent 3284b185
...@@ -28,21 +28,35 @@ while read FS_PART FS_MNT FS_TYPE FS_MORE; do ...@@ -28,21 +28,35 @@ while read FS_PART FS_MNT FS_TYPE FS_MORE; do
continue; continue;
fi fi
if echo "${FS_MORE}" | grep -iq nosoft; then
# appending "# nosoft" to the /etc/fstab entry
# will allow to strip trim and leave it disabled
tunefs -n disable ${FS_MNT}
else
# enables soft updates # enables soft updates
tunefs -n enable ${FS_MNT} tunefs -n enable ${FS_MNT}
fi
# enables TRIM FS_DEV=$(echo ${FS_PART} | awk 'match($0, /^\/dev\/(gpt|ufs)\/.+$/) { print substr( $0, RSTART + 5, RLENGTH - 5 )}')
FS_DEV=$(echo ${FS_PART} | awk 'match($0, /\/dev\/([a-z]+[0-9]+)/) { print substr( $0, RSTART, RLENGTH )}') if [ -n "${FS_DEV}" ]; then
FS_DEV=$(glabel status -as | grep ${FS_DEV} | awk 'match($3, /^[a-z]+[0-9]+/) { print substr( $3, RSTART, RLENGTH )}')
fi
if [ -z "${FS_DEV}" ]; then
FS_DEV=$(echo ${FS_PART} | awk 'match($0, /^\/dev\/[a-z]+[0-9]+/) { print substr( $0, RSTART + 5, RLENGTH - 5 )}')
fi
if [ -n "${FS_DEV}" ]; then
FS_TRIM=$(camcontrol identify ${FS_DEV} | grep TRIM | awk '{ print $5; }') FS_TRIM=$(camcontrol identify ${FS_DEV} | grep TRIM | awk '{ print $5; }')
if [ "${FS_TRIM}" = "yes" ]; then if [ "${FS_TRIM}" = "yes" ]; then
if echo "${FS_MORE}" | grep -iq notrim; then
# appending "# notrim" to the /etc/fstab entry # appending "# notrim" to the /etc/fstab entry
# will allow to strip trim and leave it disabled # will allow to strip trim and leave it disabled
if echo "${FS_MORE}" | grep -iq notrim; then
tunefs -t disable ${FS_MNT} tunefs -t disable ${FS_MNT}
else else
# enables TRIM
tunefs -t enable ${FS_MNT} tunefs -t enable ${FS_MNT}
fi fi
fi fi
fi
done < /etc/fstab done < /etc/fstab
attempts=0 attempts=0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment