User Tools

Site Tools


howtos:i_o_scheduler_algorithm

The I/O scheduler in Linux doesn't favour SSD disks so this little trick should keep a more fluent feeling on the desktop.

This hack can be utilized as either a grub setting or through a rc.local script.

Pre Grub 2:

To set the scheduler in grub append this to the kernel parameters. Find the line looking like this:

linux	/vmlinuz-2.6.31-14-generic root=/dev/mapper/myhostname-root ro quiet splash

and append this:

linux	/vmlinuz-2.6.31-14-generic root=/dev/mapper/myhostname-root ro quiet splash elevator=deadline

Grub 2:

Edit the file /etc/default/grub and find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

change it to this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=deadline"

and run:

# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /memtest86+.bin
Done

You can also make the changes in the rc.local script:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo deadline > /sys/block/sda/queue/scheduler
echo deadline > /sys/block/sdb/queue/scheduler
echo deadline > /sys/block/sdc/queue/scheduler
echo 1 > /sys/block/sda/queue/iosched/fifo_batch
echo 1 > /sys/block/sdb/queue/iosched/fifo_batch
echo 1 > /sys/block/sdc/queue/iosched/fifo_batch

exit 0

The scheduler is per disk, that's why there is a statement per device (/dev/sdX).

howtos/i_o_scheduler_algorithm.txt · Last modified: 02/12/2018 21:34 by 127.0.0.1