Improving performance on ArchLinux

ArchLinux as a distro gives quite a lot of freedom to the end user to configure the entire system. Starting with the installation that is done from the console (there are TUI and GUI variants, but I'm talking about the basic one), through the post-installation procedure, the user has to adjust everything himself in order to have a functional system, working environment, etc. In this text, I will mention one item, and that is improving the performance of classic hard drivesI will have to quote and publish one by one, because one text cannot cover everything.

A general story about the possibilities of Linux

On an old laptop that I have had for a full 10 years, I still manage to run what we would call cutting edge software. In Serbian, what appears today in a very short time reaches the Lenovo old-timer through the software repositories. And it works without problems, although slower than on new computers, but that is nothing unusual. Another thing that Linux allows, with the use of new software, is the extension of the time of use of old machines.

Improve hard drive performance

A few days ago, after the experiment I'm going to write about, I reinstalled ArchLinux and downloaded all that software. I was left with the job of configuring the system to do it as stably and quickly as possible. One of the settings I always make is the input / output scheduler. With this procedure, I enable the hard disk to work as optimally as possible, which of course has a positive effect not only on the speed of the device itself, but also on the service life.

Part of this text will be commands for displaying the active scheduler, but also listing all available ones, so that you know which ones to use in accordance with the official documentation. And of course setting up udev rules for permanent configuration, so let's get started:

Hard Disk scheduler Setup

Command to browse available planners and display the active:

cat /sys/block/sda/queue/scheduler

The command printout should look like this:

mq-deadline kyber [bfq] none

The one shown between square brackets is in active use by the system.

It can be temporarily changed with the command:

# echo bfq > /sys/block/sda/queue/scheduler

The one shown between square brackets is in active use by the system.

Temporarily means until the system restarts, after which it will return to the default one.

In order for the system to use the one we want, we have to tell the system by creating a rule and we do it through a file:

/etc/udev/rules.d/60-ioschedulers.rules

And its content would be:

# setting the NVMe disk scheduler
ACTION == "add | change", KERNEL == "nvme [0-9] n [0-9]", ATTR {queue / scheduler} = "none"
# SSD and eMMC scheduler settings
ACTION == "add | change", KERNEL == "sd [az] | mmcblk [0-9] *", ATTR {queue / rotational} == "0", ATTR {queue / scheduler} = "mq-deadline "
# set up a hard disk scheduler
ACTION == "add | change", KERNEL == "sd [a-z]", ATTR {queue / rotational} == "1", ATTR {queue / scheduler} = "bfq"

So this rule is universal in relation to the type of storage device (at the beginning I mentioned only hard drives), it is possible to change it. Of course, you only have a hard drive, then it is enough to include the last three lines in the rule. It seems silly, but it's also simple! Until the next tip and reminder (of course I'm thinking of myself here) :)