6

I'm trying to persist a readahead rule on a mounted drive to use with mongodb.

The mount is persisted using /etc/fstab and that works as expected.

I have added a udev rule ACTION=="add", KERNEL=="sdb", ATTR{bdi/read_ahead_kb}="16"in /etc/udev/rules.d/85-mongod.rules and confirmed that it works with udevadm test --action=add /sys/block/sdb.

On reboot the disk is mounted but the readahead is set to the default value, not the value set by the udev rule.

I'm running centOS 7.1 on google cloud and mounting a persistent disk.

Is this a race condition or another timing issue? Are there any workarounds? I'm reluctant to use /etc/rc.local since I'm not sure if the disk will always be mounted when it's executed, but not sure if that is actually an issue.

Thanks for any help!

datacarl
  • 161
  • 2
  • I am having the same issue - were you ever able to find a solution? – Jon Carl Dec 09 '15 at 14:26
  • Nope, gave up. Just added `blockdev --setra 32 {{disk_device_path}}` to `rc.local` instead. So far it's working but I've only restarted the machines a couple of times so I'm not sure if it's consistent. – datacarl Dec 09 '15 at 18:08
  • That's a bummer - `rc.local` works, but I like udev since the rule can apply based on wildcards and such – Jon Carl Dec 09 '15 at 19:34
  • I think your rule is not picked up / too far behind. Try to use the uuid of the disk, see this answer: http://superuser.com/questions/521402/use-uuid-in-udev-rules-and-mount-usb-drive-on-media-uuid – AndreasM Feb 26 '16 at 12:58

1 Answers1

0

If you have a Red Hat login: https://access.redhat.com/solutions/4378581

cat /lib/tuned/throughput-performance/tuned.conf | grep -iB1 readahead

You will want to change "readahead=>4096" to "readahead=>0".

WesMan
  • 1