21

I have a Linux server system installed on an SSD and an HDD for user data. As there is space left on the SSD, I want to use it as a read cache for the HDD.

Looking at the possibilities, I found:

  • dm-cache: Needs a lot of reads before caching shows performance improvements according to https://www.redhat.com/en/blog/improving-read-performance-dm-cache. I think in my use case this is not a good strategy.

  • lvmcache: Builds on dm-cache and I'd need to put the SSD and HDD into one LV. I'd like to keep the cache transparent, so I can easily put the HDD into another system without having to do LVM magic first.

  • Bcache: I'd need to format the HDD for Bcache. Not what I want.

  • Flashcache: Sounds like what I want (just switch it on), but not actively maintained anymore according to https://github.com/facebookarchive/flashcache.

  • EnhanceIO: Builds on Flashcache, but dead since 2015.

Is there anything similar to Flashcache or EnhanceIO, but still actively maintained?

1
  • How about ZFS + L2ARC?
    – Malachi
    Dec 5 '19 at 22:32
3

That is a decent survey of Linux kernel block caches. Of those, I only consider lvmcache and bcache: integrated into kernel and documented by stable distributions.

Both require a format for metadata, that is not going to be easy to avoid.

Moving disks to a different system is relatively easy if the target system also has caching support. LVM capable distros will scan for volumes, if not automatically with a simple command. Similar for bcache.

Either way, mount the volumes by file system UUID or label, abstracting away from device numbering.

Test procedures for removing the cache in planned and unplanned scenarios. Such as bcache in detached passthrough mode. Once you can recover just the backing disk without its cache, no need to revert to a raw, pre-cache disk anymore.

1
  • User wants to move the drive to a different system without moving/enabling the cache. Sounds like there is no solution to what the user wants, a toggleable cache.
    – G Huxley
    Jan 13 at 22:28
2

EnhanceIO is still maintained by the community. There is a fork by lanconnected that has been patched for recent kernels and a couple other forks with the last commits around the same time (April 2019). I've been using it with btrfs on Arch through dkms for a couple years and haven't noticed any major issues.

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.