2

I can manage /proc directory settings with sysctl and config files in /etc/sysctl.d but is there equivalent tool for the /sys directory? I want to change the I/O scheduler to bfq permanently.

Should I just create service file pointing to some script containing:

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

?

2

I usually create udev rules for persistently setting sysfs attributes. For example:

ACTION=="add|change", KERNEL=="sda", ATTR{queue/scheduler}="noop"
ACTION=="add|change", KERNEL=="sda", ATTR{queue/nr_requests}="1024"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{device/model}=="VRAID", ATTR{queue/scheduler}="noop"

The above sets "noop" as the scheduler on sda explicitly, then set's nr_requests to 1024 on the same drive, then it filters for a block device with "VRAID" as the model (which would be a SAN volume) and sets it there too. If you wanted more information on how to write rules here you go.

This has the benefit of letting you set defaults for devices that don't exist yet. The rules will be invoked as the devices are presented to the system. For example, if I log into an iSCSI LUN, then it's going to start out with a "noop" scheduler without me having to do anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.