[linux-lvm] Setting readahead for Logical Volumes via udev

David Wittman dwittman at gmail.com
Mon May 19 15:58:21 UTC 2014


Hey all,

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.

Here's the udev rule I'm using, followed by an example:

```
# cat /etc/udev/rules.d/83-readahead.rules
# Set the readahead on non-spinning disks to 8kb (16 512b sectors)
ACTION=="add", KERNEL=="dm-*", ATTR{queue/rotational}=="0",
ATTR{bdi/read_ahead_kb}="8"

# lvcreate -L 100G data_fioa -n readahead_test
  Logical volume "readahead_test" created

# blockdev --report
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0    107374182400   /dev/dm-0
```

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:

> udevd-work[4778]: ATTR
'/sys/devices/virtual/block/dm-1/bdi/read_ahead_kb' writing '8'
/etc/udev/rules.d/83-readahead.rules:3

(Note: this is an earlier log entry; I have since disabled debug logging,
so ignore any inconsistencies here)

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:

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

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:

Distro: CentOS 6.4
LVM2 version: lvm2-2.02.98-9.el6_4.3.x86_64
udev version: udev-147-2.46.el6_4.2.x86_64

Thanks,

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20140519/8ee404c6/attachment.htm>


More information about the linux-lvm mailing list