Ubuntu – Making stripe_cache_size permanent

mdadmserver

I did

echo 8192 > /sys/block/md0/md/stripe_cache_size

to improve my RAID performance, and it did helped alot.

But I still can't figure out how to make it permanent.

I was trying to set it in /etc/rc.local – other commands are executed, but it was overwritten to 256 elsewhere… Any hints?

Best Answer

Add a udev rule, e.g. to /etc/udev/rules.d/60-md-stripe-cache.rules:

SUBSYSTEM=="block", KERNEL=="md*", ACTION=="change", TEST=="md/stripe_cache_size", ATTR{md/stripe_cache_size}="8192"

I haven't actually tried this so it might not be 100% right (may be some typos), but it should be close. Check man udev to understand more.

You may also want to run the following commands afterwards to immediately apply the new rule:

udevadm trigger
udevadm control --reload-rules