大网数据广告活动
服务器运维问答

Linux SSD as HDD cache

· 52CE 我爱测

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 bef…

问题原文

原帖链接 · GxB · CC BY-SA 4.0

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?

社区高分解答

原帖链接 · John Mahowald · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-05-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。