From 44b610abb1a6f36729909dee442feb5566d88d05 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 16 Apr 2015 11:46:36 +0200 Subject: [PATCH] rc: enable soft updates and TRIM (when available) --- src/etc/rc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/etc/rc b/src/etc/rc index a59cf50bc..47e582adb 100755 --- a/src/etc/rc +++ b/src/etc/rc @@ -19,6 +19,23 @@ export HOME PATH echo "Mounting filesystems..." +while read FS_PART FS_MNT FS_TYPE FS_MORE; do + # only tune our own file systems + if [ "${FS_TYPE}" != "ufs" ]; then + continue; + fi + + # enables soft updates + tunefs -n enable ${FS_PART} + + # enables TRIM + 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_PART} + fi +done < /etc/fstab + attempts=0 while [ ${attempts} -lt 3 ]; do if mount -a 2>/dev/null; then