[CentOS] Correct way to change I/O scheduler in a iSCSI dev

Santi Saez santi at usansolo.net
Fri Nov 28 15:11:23 UTC 2008


Santi Saez escribió:
> What's the correct way to change configuration parameters for an iSCSI
> device? For example I/O scheduler, max_sectors_kb, etc...
>
> I could add commands to the S99local script:
>
>   echo noop > /sys/block/sdb/queue/scheduler
>   echo 64 > /sys/block/sdb/queue/max_hw_sectors_kb
>
> Unfortunately, iSCSI device names might change from sdb to, say, sdc
> (server reboot, iSCSI target reconnection). If this happens, customizations
> would be lost or applied to a different device.
>
> Any workaround for this using centOS? sysctl, udev, anything else? It also
> may be applied to Fiber Channel devices.
Finally I think using udev to tune device config is the best and 
simplest way.

$ cat /etc/udev/rules.d/99-san.rules

# $Id: 99-san.rules.udev 13 2008-11-28 10:20:32Z santi $
# Set "noop" as I/O scheduler for iSCSI and Fiber Channel devices
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-iscsi-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"
ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="*-fc-*", RUN+="/bin/sh -c 'echo noop > /sys$DEVPATH/queue/scheduler'"

(To prevent line wrapping, udev rule it's also available at http://pastebin.com/f5ce875a1)

When new iSCSI or FC device is added udevd will execute $RUN command; I set !="filesystem" condition to prevent running the command for each partition, executing only for block devices.

Regards,

--
Santi Saez
http://woop.es



More information about the CentOS mailing list