大网数据广告活动
服务器运维问答

Data scrubbing and repairing a RAID1 mirror?

· 52CE 我爱测

In Linux, if I have a software RAID1 mirror /dev/md1 with N ≥ 1 active devices, what are the semantics of the repair command? echo "repair" >/sys/block/md1/md/sync_action Am I correct to assume that in case of 1 active device, th…

问题原文

原帖链接 · jotik · CC BY-SA 3.0

In Linux, if I have a software RAID1 mirror /dev/md1 with N ≥ 1 active devices, what are the semantics of the repair command?

echo "repair" >/sys/block/md1/md/sync_action

Am I correct to assume that

  • in case of 1 active device, the repair command does nothing,
  • in case of 2 active devices, the repair command searches for data discrepancies and overwrites mismatched data of one of the devices with the mismatched data from the second device, and
  • in case of 3 (or more) active devices, the repair command searches for data discrepancies, figures out (if possible) or decides which data contents are most prevalent and with this data overwrites the mismatched data on other devices?

I've read Documentation/admin-guide/md.rst and even Documentation/device-mapper/dm-raid.txt from the Linux kernel documentation, but these are currently not very informative. I've also tried to understand drivers/md/raid1.c but its not very well commented and I lack knowledge of Linux kernel internals to understand it.

已采纳解答

原帖链接 · shodanshok · CC BY-SA 3.0

If code has not changed, 3-way RAID1 is not going to give you smart/better recovery comparable to BTRFS/ZFS scrubs.

From the main mdraid developer's blog:

It is my position that if there is an inconsistency that needs to be corrected then it should be corrected in a simple predictable way and that any extra complexity is unjustified. For RAID1, that means copying to first block over all the others

Give also a look here. An abstract:

It has already read all blocks and now compares them to see if they are the same. If not it copies the first to any that are different.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-04-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。