Hi All,

I'm using a raid1 setup with the raidtools 0.90 and mingo's raid patch
against the 2.2.15 kernel.

My question is how does the raid driver decide which disk in the mirror to
use as the source for synchronization when mkraid is used?

I tried a few experiments to see how it behaved. The /etc/raidtab is as
follows:

raiddev /dev/md0
    raid-level              1
    nr-raid-disks           2
    nr-spare-disks          0
    chunk-size              4
    persistent-superblock   1
    device                  /dev/sdb1
    raid-disk               0
    device                  /dev/sdc1
    raid-disk               1

My first experiment was to shutdown, unplug /dev/sdc1, and bring up the
system again. The raid driver happily ran the mirror in degraded mode. I
wrote some files onto /dev/md0, rebooted the machine, with
/dev/sdc1 plugged back in. /dev/md0 continued to run in degraded mode
until I ran mkraid to resynchronize the mirror. The files that were
written to /dev/md0 while it was running in degraded mode were preserved.
:)

I then tried the same experiment, but this time unplugged /dev/sdb1 so
/dev/sdc1 (which became /dev/sdb1) ran in degraded mode after the reboot.
I wrote some files onto /dev/md0 while it was in this state. After
plugging the original /dev/sdb1 in after a reboot, the mirror continued to
run in degraded mode, but this time using /dev/sdc1, because the
persistent superblock was more up to date. I then ran mkraid to
resynchronise the mirror again, but this time, the files written to
/dev/md0 in degraded mode (really /dev/sdc1) had disappeared!
:(

So, when /dev/md0 is set up with raid1, does it always use raid-disk 0 as
the source for a resync?

My concern is if /dev/sdb1 really crashes and I replace it with another
fresh disk, partition it the same as before, and do a resync, everything
on /dev/sdc1 (raid-disk 1) will be deleted.

If this is the case, I presume the solution would be to change the SCSI id
of /dev/sdc1 so it becomes /dev/sdb1 in the mirror, making it raid-disk 0?

Thanks,
Ben.

Reply via email to