How to set NOOP scheduler at system boot

There are many different ways to set NOOP scheduler on the first hard drive at system boot. I have decided to use simple systemd service, but alternatively you can use udev to automatically configure every SSD device (see References section).

Create systemd service file to set NOOP scheduler on first hard drive at system boot.

$ cat << EOF | sudo tee /etc/systemd/system/noop.service
[Unit]
Description=SDA noop scheduler

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo noop | tee /sys/block/sda/queue/scheduler'

[Install]
WantedBy=multi-user.target
EOF
Notice that I have used oneshot process start-up type as I only want to execute an action without keeping active process.

Reload systemd manager configuration.

$ sudo systemctl daemon-reload

Enable service at boot time.

$ sudo systemctl enable noop.service

References

systemd.service — Service unit configuration [freedesktop.org]

Noop scheduler [wikipedia.org]

SSDOptimization [debian.org] (udev rules)

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland https://sleeplessbeastie.eu