Hello all,
I'd like to ask whether it is necessary to switch the write cache of
HDDs and
SSDs (without power-loss-protection) to off when they are used for
mdraid.
As discussed by Nik.Brt. and Song Liu last week, many storage devices
(HDDs/SSDs) "lie" when they indicate that the have written data. The
data is
only in the drive's cache, but not on magnetic disc or flash. "The
disk's
embedded microcontroller may signal the main computer that a disk write
is
complete immediately after receiving the write data, before the data is
actually
written to the platter." [1]
When used as a single disc, this can be handled with modern file
systems, as
they use write barriers. [2][3]
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.
So my questions is:
Is it save to keep the cache of HDDs and SSDs (without
power-loss-protection)
to on when used with mdraid?
Best regards,
Werner
[1] https://en.wikipedia.org/wiki/Disk_buffer#Write_acceleration
[2] https://www.spinics.net/lists/linux-ext4/msg24130.html
[3]
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/storage_administration_guide/ch-writebarriers#writebarrierswhyneed