After running into issues with running out of kernel memory, I increased the chunksize of my lvmcache from the default (which I believe was 64k) to a much higher 8M.

After this change, blocks do not seem to be promoted to the cache, despite constant use with both reads and writes. The meta cache is being used however (at a roughly similar rate to before the chunksize change). The cache was created in writeback mode.

media-media: 0 46883430400 cache 8 277/2621440 16384 0/56320 0 2903157 0 1259187 0 0 0 1 writeback 2 migration_threshold 2048 smq 0 rw -

Is there a way to investigate why blocks are not being promoted? I understand this large chunk size will likely be a lot less efficient in the general case, but surely some blocks should be promoted?


This was a bug which, at least on RedHat, has now been fixed from RHEL 7.7 onwards. It was an issue with migration_threshold which dropped below chunk size when the chunk size went above 1MB. Blocks are promoted in multiples of migration_threshold.

LVM2 now ensures there is always minimal value at 8 chunks.


| improve this answer | |

It seems the LVM cache has problem with cache chunk size larger than 1M. (https://marc.info/?l=linux-lvm&m=152948734523317&w=2)

In my case the chunk size is 1.06M, which was determined by the lvcreate command automatically. The cache was created in writethrough mode. Then I changed it to writeback, the block promotes; but when I try to flush the cache, the dirty blocks cannot be written to the disk.

I have to destroy the whole LV, since the cache cannot be split safely. Recreate the cachepool with --chunksize=512k and the cache flushing works. Are you still using LVM cache? What's your current cache chunk size?

| improve this answer | |
  • I never found a solution so have migrated away from lvm based caching. Tweaking my chunk size manually got it caching again, but it was a bit of a black-box, so not something I wanted to continue using. – ss23 Dec 1 '18 at 8:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.