Using multiple SSDs as cache devices with bcache

bcache

If we have three SSDs installed in a system, with a spare partition for the unused space on the SSD (/dev/sda2, /dev/sdb2 and /dev/sdc2). Can bcache be configured to use all three of those partitions to cache a single backing device (such as /dev/md10 which is laid on top of /dev/sd[defghij]1).

From what I have read elsewhere, it is possible that a particular SSD device can be used by bcache to cache multiple hard drives or RAID arrays. But nothing explains whether a backing device can be cached by multiple SSDs at the same time.

For instance, you might have three 100GB SSDs instead of a single large 300GB SSD, and you want to use those as caching devices for a single 12TB array.

Best Answer

The bcache documentation clearly states that you can use one caching device for multiple backends but not vice versa (at least not yet). But you are free to arrange your SSDs in a RAID-0, RAID-1, or RAID-5, initialize the caching volume on this volume set and attach your backends to it.

Keep in mind that you may want to have at least one mirror or parity in your SSD RAID if you prefer reliability over pure speed. I figure you want to go with the reliable choice if you are backing a 12 TB data volume with it.

Please take into account that introducing a storage layer like LVM oder MD between bcache and the hardware can or probably will modify write guarantees for bcache - thus in that case you should not use write-back mode of bcache as that setup can lead to servere structural problems within bcache at reboot, shutdown, and clearly powerloss, and you don't want to have outstanding writes in that case. I suggest putting the SSDs into a battery backed hardware RAID before using write-back mode. And while you are there: Such a setup usually allows using SSDs as a CacheCade layer through the RAID controller, making bcache superfluous.

Related Question