Last active
October 12, 2021 21:56
-
-
Save tsaavik/6979047 to your computer and use it in GitHub Desktop.
Inspired by the tuner scripts we used at mp3.com, this sets some performance options for hard disks, and has some specific optimizations for SSD/NVMEs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Tweak hard drive performance stuff | |
for drive in sda sdb sdc sdd; do | |
if [[ -e /dev/${drive} ]] ;then | |
#increase readahead buffer on sata devices | |
/sbin/blockdev --setra 2048 /dev/${drive} | |
echo 1024 > /sys/block/${drive}/queue/read_ahead_kb | |
if smartctl -a /dev/${drive} |grep SSD;then | |
#SSDs do not have latency issues like traditional hdd so we tweak | |
echo "/dev/${drive} is a SSD, tweaking proc entries" | |
echo deadline > /sys/block/${drive}/queue/scheduler | |
echo 32 > /sys/block/${drive}/queue/read_ahead_kb | |
echo 1 >/sys/block/${drive}/queue/iosched/fifo_batch | |
echo 0 > /proc/sys/vm/swappiness | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment