2

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.

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.