bcache keeps frequently-accessed data fast

bcache keeps frequently-accessed data fast

05 February, 2020 1 min read
filesystems, bcache, Linux, storage, open source

Most traffic on our office network relates to a set of the most frequently and recently accessed 10 GB of files (at most) out of a total of ~200 GB on a RAID1 array of slow-yet-reliable 2-TB hard disks.

Does this mean that we have to settle for the low hard disk speeds every single time we access these files via Samba?

Not with Linux!

With bcache the RAID0 array serves as the backing device, and a 40 GB partition on an inexpensive-yet-fast SSD serves as a read-caching device.

This means that we automatically get the most important files “hot and ready to serve” from the SSD cache while benefitting from the large HDD capacity full of “cold” data that is only used infrequently, if ever.

It was a breeze to set up bcache combined with an mdadm array on Debian 10. Most importantly, I simulated possible SHTF scenarios (HDD1/HDD2/SSD failure) and it was dead simple and straightforward to recover and read all files.

Our new server is thus getting ready to serve us well for the next 10+ years without a hiccup—just like our current one, which sports Debian 6 on a Pentium 4 (!) at 2.66 GHz (and no hyperthreading), has done since 2006.