From 414533ea374098bf729d2864efff19e8ce80ff17 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 18 Sep 2013 21:38:35 -0400 Subject: [PATCH] Add bootscript to tune disk parameters --- stage1/bootscripts/tune | 38 ++++++++++++++++++++++++++++++++++++++ stage1/install-bootscripts | 1 + 2 files changed, 39 insertions(+) create mode 100755 stage1/bootscripts/tune 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 -- 2.20.1