From bbee0103dd9310e7fc7de08265da87f8be62dc33 Mon Sep 17 00:00:00 2001 From: jerry048 Date: Tue, 28 Feb 2023 14:53:06 +0800 Subject: [PATCH] Update tweaking.sh --- tweaking.sh | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/tweaking.sh b/tweaking.sh index 57a185b..ae8ef3c 100644 --- a/tweaking.sh +++ b/tweaking.sh @@ -45,7 +45,7 @@ function Network_Other_Tweaking { apt-get -qqy install net-tools ifconfig $interface txqueuelen 10000 sleep 1 - #Other 2 + #Increaseing the congestion windows iproute=$(ip -o -4 route show to default) ip route change $iproute initcwnd 25 initrwnd 25 } @@ -57,35 +57,30 @@ function Scheduler_Tweaking { normal_1; echo "Changing I/O Scheduler"; warn_2 i=1 drive=() + #List out all the available drives disk=$(lsblk -nd --output NAME) + #Count the number of drives diskno=$(echo $disk | awk '{print NF}') + #Putting the device name in an array to loop through later while [ $i -le $diskno ] do device=$(echo $disk | awk -v i=$i '{print $i}') drive+=($device) i=$(( $i + 1 )) done - i=1 - x=0 - disk_name=$(printf $(lsblk | grep -m1 'disk' | awk '{print $1}')) - disktype=$(cat /sys/block/$disk_name/queue/rotational) - if [ "${disktype}" == 0 ]; then - while [ $i -le $diskno ] - do - diskname=$(eval echo ${drive["$x"]}) + i=1 x=0 + #Changing the scheduler per disk depending on whether they are HDD or SSD + while [ $i -le $diskno ] + do + diskname=$(eval echo ${drive["$x"]}) + disktype=$(cat /sys/block/$diskname/queue/rotational) + if [ "${disktype}" == 0 ]; then echo kyber > /sys/block/$diskname/queue/scheduler - i=$(( $i + 1 )) - x=$(( $x + 1 )) - done - else - while [ $i -le $diskno ] - do - diskname=$(eval echo ${drive["$x"]}) + else echo mq-deadline > /sys/block/$diskname/queue/scheduler - i=$(( $i + 1 )) - x=$(( $x + 1 )) - done - fi + fi + i=$(( $i + 1 )) x=$(( $x + 1 )) + done }