From: Hugo Villeneuve Date: Thu, 19 Sep 2013 01:38:35 +0000 (-0400) Subject: Add bootscript to tune disk parameters X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=414533ea374098bf729d2864efff19e8ce80ff17;p=hvlinux.git Add bootscript to tune disk parameters --- diff --git a/stage1/bootscripts/tune b/stage1/bootscripts/tune new file mode 100755 index 0000000..ac578dc --- /dev/null +++ b/stage1/bootscripts/tune @@ -0,0 +1,38 @@ +#!/bin/bash + +# tune +# Tune kernel parameters for hardware + +# Source functions library +source /etc/rc.d/init.d/functions + +log_script_name "$0 $*" + +tune_disks() +{ + cd /sys/block + + for disk in * ; do + if cat /sys/block/${disk}/queue/rotational | grep -q 1 ; then + echo "cfq" > /sys/block/${disk}/queue/scheduler + else + # SSD + echo "deadline" > /sys/block/${disk}/queue/scheduler + fi + + echo -n "Scheduler for disk ${disk} = " + cat /sys/block/${disk}/queue/scheduler | sed "s/.*\[\(.*\)\].*/\1/" + done +} + +case "${1}" in + start) + cmd_run_log_box "Tuning disk parameters" tune_disks + ;; + *) + echo "Usage: $0 {start}" + exit ${EXIT_CODE_FAILURE} + ;; +esac + +exit $? diff --git a/stage1/install-bootscripts b/stage1/install-bootscripts index 15f22e8..5b03164 100755 --- a/stage1/install-bootscripts +++ b/stage1/install-bootscripts @@ -31,6 +31,7 @@ done bootscript_add_rcsysinit initlog 05 00 bootscript_add_rcsysinit hostname 10 00 bootscript_add_rcsysinit mountkernfs 15 00 +bootscript_add_rcsysinit tune 17 00 bootscript_add_rcsysinit modules 20 00 bootscript_add_rcsysinit udev 25 00 bootscript_add_rcsysinit checkfs 30 00