Quick HOWTO: Change I/O Scheduler in Linux

By Parthiban Ponnusamy



I/O schedulers in Linux


noop - It can be helpful for devices that do I/O scheduling themselves, as intelligent storage, or devices that do not depend on mechanical movement
cfq - A fairness-oriented scheduler. It tries to maintain system-wide fairness of I/O bandwidth
deadline - A latency-oriented I/O scheduler. Each I/O request has got a deadline assigned.
as (anticipatory) - conceptually similar to deadline, but with more heuristics to improve performance (It may decrease performance in some cases)

Here is the procedure to change the default I/O scheduler in Linux.


Dynamically setting the default I/O scheduler to a Particular Disk:

Example: 
echo "scheduler_name" > /sys/block/<Disk_Name>/queue/scheduler

To set I/O scheduler to all the Disk drives on the Linux server:

for disk in `ls -1 /sys/block |egrep '^emc|^sd'`;
do
echo "deadline" > /sys/block/$disk/queue/scheduler;
done

To verify the settings:
for dsk in `ls -1 /sys/block |egrep '^emc|^sd'`;
do
echo -e "$i\t\c";
cat /sys/block/${dsk}/queue/scheduler;
done
Permanently set the default I/O scheduler in Linux via Grub menu:

Implement permanent setting by adding “elevator=noop” to the default stanza in the /boot/grub/menu.lst file

1. Create backup 
cp -p /boot/grub/menu.lst /boot/grub/menu.lst-backup
2. Update menu.lst 

Example:
kernel /vmlinuz-2.6.16.60-0.91.1-smp root=/dev/sysvg/root splash=silent splash=off showopts elevator=noop