Udev rule for changing 'max_sectors_kb' for all 'sd*' devices

tomstephens89

Renowned Member
Mar 10, 2014
202
11
83
Kingsclere, United Kingdom
I am having a problem creating a udev rule that sets max_sectors_kb to 1024 for sd* (sda,sdb,sdc etc...) devices under /sys/block/.

Specifically, a recent kernel change means the max IO is too large for my iSCSI SAN so I am trying to set it to 1024 on startup.

I have tried the following from articles online, but none seem to have an effect.

ACTION==”add|change”, SUBSYSTEM==”block”, RUN+=”/bin/sh -c ‘/bin/echo 1024 > /sys%p/queue/max_sectors_kb’”

or

ACTION=="add", ENV{ID_FS_USAGE}!="filesystem", ENV{ID_PATH}=="-iscsi-", RUN+="/bin/sh -c 'echo 64 > /sys$DEVPATH/queue/max_sectors_kb'"

When I run cat cat /sys/block/sdX/queue/max_sectors_kb the value is still the 32767 default.

What do I need to do?