<div dir="ltr">Hey all,<div><br></div><div>I'm having an issue tuning the readahead value for my Logical Volumes via udev. In short, I'm trying to create a rule that sets the readahead attribute for each of my Logical Volumes at boot time or upon the creation of a new volume. udev seems like the perfect place to do this, but for some reason or another LVM seems to be overriding these settings.</div>

<div><br></div><div>Here's the udev rule I'm using, followed by an example:</div><div><br></div><div>```</div><div><div># cat /etc/udev/rules.d/83-readahead.rules</div><div># Set the readahead on non-spinning disks to 8kb (16 512b sectors)</div>

<div>ACTION=="add", KERNEL=="dm-*", ATTR{queue/rotational}=="0", ATTR{bdi/read_ahead_kb}="8"</div></div><div><br></div><div><div># lvcreate -L 100G data_fioa -n readahead_test</div>

<div>  Logical volume "readahead_test" created</div></div><div><div><br></div><div># blockdev --report</div><div>RO    RA   SSZ   BSZ   StartSec            Size   Device</div><div>rw   256   512  4096          0    107374182400   /dev/dm-0</div>

</div><div>```</div><div><br></div><div>You'll notice above that the readahead is still 256 512-byte sectors. The same happens upon a reboot of the system. Despite this, I do see information in logs from udev that it is writing this value:</div>

<div><br></div><div>> udevd-work[4778]: ATTR '/sys/devices/virtual/block/dm-1/bdi/read_ahead_kb' writing '8' /etc/udev/rules.d/83-readahead.rules:3</div><div><br></div><div>(Note: this is an earlier log entry; I have since disabled debug logging, so ignore any inconsistencies here)</div>

<div><br></div><div>With all that said, I am quite certain that the udev rules are correct, because after running `udevadm trigger`, the readahead values are then set properly:</div><div><br></div><div>```</div><div><div>

# udevadm trigger</div><div># blockdev --report</div><div>RO    RA   SSZ   BSZ   StartSec            Size   Device</div><div>rw    16   512  4096          0    107374182400   /dev/dm-0</div></div><div>```</div><div><br></div>

<div>I've tried tweaking a few of the udev specific values in lvm.conf, to no avail. Any help or suggestions are appreciated. Here are my system details:</div><div><br></div><div>Distro: CentOS 6.4</div><div>LVM2 version: lvm2-2.02.98-9.el6_4.3.x86_64</div>

<div>udev version: udev-147-2.46.el6_4.2.x86_64</div><div><br></div><div>Thanks,</div><div><br></div><div>Dave</div></div>