problem / observed effect

It seems that the page cache ignores block devices which are not opened. And worse: Reads from device mapper (DM) devices which use a cached device are not cached at all (unless opened).

I use this command (in repetition) for testing:

time dd if=/dev/sda11 of=/dev/null bs=50M count=1

If sda11 is opened for reading (exec 4</dev/sda11), mounted or part of a device mapper device (echo "0 1427456 linear /dev/sda11 0" | dmsetup create cache1) then the cache works.

But if I create /dev/mapper/cache1 on top of sda11 neither the first read nor the second one comes from the cache (if it is not opened somehow).


The reason why I am doing this: I have an encrypted volume and booting my (KDE) system takes quite a while. I do some manual preparations before I open the encrypted volume thus I thought I might use this time for reading from the encrypted device (LVM) in order to speed up the KDE start. But for the mentioned caching problem this is of no use.


Is there any trick to read from the LV in a way that the later created DM crypto device reads from it through the (filled) cache?

  • Just a guess:try something as losetup for /dev/mapper/mapperdevice or anything to make it opend in background in initramfs script? – illiterate Dec 31 '19 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.