But what I'm not sure is, how this is handled by mdraid in case of a
sudden
power loss. In the past I've recommended to disable the drive's
write
cache by
using "hdparm -W0". This is also the default behavior of hardware
raid
controllers. They switch off the drive cache of HDDs as they use
their
internal
(battery-backed) cache.
I would recommend to use an UPS, if the situation is
so critical to consider cache on / off configuration.
Of course UPS is always a good idea to minimize the probability of a
power failure. Nevertheless there is the possibility of an outage of the
power supply. Or in case of redundant power supplies the possibility of
an outage of the server's power distribution unit.
So my question "Is it save to keep the cache of HDDs and SSDs (without
power-loss-protection)
to on when used with mdraid?" could also be asked like:
Does mdraid treat write barriers fully correct, so that a filesystem
ontop of mdraid won't be broken after a power failure?