D
D
DmitryKoterov2012-05-25 14:38:36
linux
DmitryKoterov, 2012-05-25 14:38:36

How does mdadm rasync know which drive has a valid block and which doesn't?

When RAID1 is rezinka, what happens at that moment? Does it always
1) copy from the first disk to the second?
2) or does it store the timestamp of its changes somewhere for each block, and copy blocks that are newer (i.e., can copy part of the blocks from the first disk to the second, and part from the second to the first)?
If (1), then how do you know which disk is the "master" and which is the "slave"?
If (2) then where is the place where the timestamp is stored? In the block itself, it is unlikely to be (or is it still there?).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
merlin-vrn, 2012-05-28
@merlin-vrn

From the superblock.
here is its format on disk: raid.wiki.kernel.org/index.php/RAID_superblock_formats#Section :_Array-State_Information_area
> Event Count for the Array — Incremented whenever the superblock is updated. Used by mdadm in re-assembly to detect failed/out-of-sync component devices.
You don't even need to translate.

M
Mikhail Konyukhov, 2012-05-28
@piromanlynx

Here, depending on what is considered desynchronization, there are several cases:
1) one disk registered by mdadm fails - then it marks it as failed and waits for a replacement, then takes data from a normal disk.
2) the failure of one disk noticed by the administrator, and marking it manually as fail, the algorithm is the same for the first one
3) the so-called “one-time error” - when both disks were normal, and suddenly there were different data between them. such an error has no normal way to recover in raild1. I can’t say which disk it takes data from, but it doesn’t restore fs data - it falls on the shoulders of fsck and the file system journal.
for example, the third case can be caused by a power outage, if there is ext3 - it's okay, the log will do its job and restore everything (if it managed to write the log), if for example XFS - goodbye data. you can even experiment with a virtual machine)
in this regard, raid5 is better - it is insured against a one-time error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question