> 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. I would recommend to use an UPS, if the situation is so critical to consider cache on / off configuration. -- piergiorgio