On Wed, Nov 14, 2018 at 04:09:51PM +0100, Emmanuel Florac wrote: > am I right to assume that it's safer to create a RAID-1 (for instance > with md) of two SSDs before setting up bcache as a writeback device? > > Any hint welcome :) That's a big question. In my opinion the safest way is to set the target for dirty data to zero (and reasonable writeback rate parameters). In that case, anytime the system is idle, everything gets written to the backing device and a loss of the caching device is not a problem. Now why I'm not saying outright "Yes, do a RAID-1": Bcache relies on barriers for cache device consistency. Without a battery-backed RAID controller, it's hard to ensure RAID consistency in the event of a power loss, since barriers passed down the device queues are not synchronized. So in the naïve approach of just sending the same stream of requests to each drive, one queue can progress further than the other in the event of a power loss, resulting in an inconsistent content, resulting in subsequent data corruption when reads are interleaved. A battery backed memory on a RAID controller card can fix that, keeping all written data until confirmed by the drives. But then - the memory is again a single point of failure. Good thing that memories tend to be quite reliable. Without a battery-backed RAM using a software RAID (md), Linux simply resorts to only sending one barrier operation at a time to the underlying drives plus additional housekeeping like a write intent bitmap. This fixes the consistency problem, however comes at a significant performance cost. Again, something you don't want with a cache device. So, make your own decision based on your usecase. :) -- Vojtech Pavlik Director SUSE Labs