Setting the I/O scheduler for a single disk on Fedora
You can set your IO scheduler on-the-fly by echoing the scheduler you want into /sys/block/{DEVICE-NAME}/queue/scheduler
. This setting, however, does not persist across system reboots. The legacy method is to place this command in /etc/rc.local
or by placing an elevator variable in grub.cfg
.
Beginning with Fedora 20, a better way of tuning your system has emerged: tuned
.
tuned
is a daemon that monitors your system and updates it based upon the variables at that moment. For instance, it will scale back your network interface – reducing power consumption – when it is not in use and will return it to full throttle when you are downloading the latest Fedora ISO. Enabling tuned
on Fedora 22 is as simple as:
sudo dnf install tuned
systenctl enable tuned
systemctl start tuned
tuned
comes pre-installed with default profiles (listed by running tuned-adm list
). By default the IO scheduler is set for all disks on the system. Since this is not the behavior we intend, nor the result we want, we will have to create our own profile for tuned
.
System profiles are stored in /usr/lib/tuned
and custom profiles are stored in /etc/tuned
. Creating a custom profile is as simple as finding the recommended for your system, copying it to a new profile, editing it, and applying it.
sudo mkdir /etc/tuned/andrewwippler
sudo cp /usr/lib/tuned/$(tuned-adm recommend)/tuned.conf /etc/tuned/andrewwippler/tuned.conf
tuned.conf
has a simple structure:
[NAME]
type=TYPE
devices=DEVICES
setting1=value
setting2=value
...
In the event of your NAME
being the same as the TYPE
, you can omit the type line. For example, a normal disk declaration looks like this:
[disk]
# Comma separated list of devices, all devices if commented out.
# devices=sda
alpm=medium_power
Now all we have to do is append our declaration to /etc/tuned/andrewwippler/tuned.conf
for sda’s elevator switch and enable it.
[my_ssd_disk]
type=disk
devices=sda
elevator=noop
I can then enable my custom tuned profile by running tuned-adm profile andrewwippler
.