When using software RAID and LVM on Linux, which IO scheduler and readahead settings are honored?
Solution 1:
If you do a read from md0 then the readahead for md0 is used. If you did the read from sda which is a component of md0 then it would use the sda setting. Device mapper just splits an I/O up into multiple reads and writes to do the RAID, but that's all below the block cache layer where readahead takes place. The storage stack looks like:
filesystem - bypasses cache when you open with O_DIRECT
block cache - readahead, write cache, scheduler
device-mapper - dm, lvm, software RAID, snapshot, etc.
sd - disk driver
SCSI - error handling, device routing
hardware driver - scsi card, FC card, ethernet
Note that when you do
dd if=/dev/sda of=foo
you are reading sda as a file, so you are going through block cache. To go direct to the disk, do
dd if=/dev/sda of=foo iflag=direct
As for I/O elevator schedulers, those only exist on the disk driver (sd). There is no queue directory under /sys/block/md or /sys/block/dm. You only go through the disk elevator sort once.