Well, I did it, and it turned out to be quite painless: the old RAID setup was automatically detected as /dev/md0, so all I had to do was mount /dev/md0 /mnt
, then copy all the data from it to whereever appropriate.
After that I issued:
mdadm --stop /dev/md0
mdadm --remove /dev/md0
sfdisk -d /dev/sda | sfdisk /dev/sdc
mdadm --add /dev/md1 /dev/sdc1
mdadm --add /dev/md2 /dev/sdc2
mdadm --add /dev/md3 /dev/sdc3
If I understand everything correctly, that was all I needed to do, since mdadm --detail
now reports the drives to be actively synced.
You can force a check of (eg) md0 with
echo "check" > /sys/block/md0/md/sync_action
You can check the state of the test with
cat /sys/block/md0/md/sync_action
while it returns check
the check is running, once it returns idle
you can do a
cat /sys/block/$dev/md/mismatch_cnt
to see if the mismatch count is zero or not. Many distros automate this check to run eg weekly for you anyway, just as most industrial hardware RAIDs continually run this in the background (they often call it "RAID scrubbing") while the array is otherwise idle. Note that according to the comments in fedora's automated check file, RAID1 writes in the kernel are unbuffered and therefore mismatch counts can be non-zero even for a healthy array if the array is mounted.
So quiescing the arrays by doing this check while the VM is down, if at all possible, is probably a good idea.
I'd add that I agree with the docs when they say that
RAID cannot and is not supposed to
guard against data corruption on the
media
RAID is supposed to guard against complete failure of a device; guarding against incremental random failures in elements of a storage device is a job for error-checking and block-remapping, which is probably best done in the controller itself. I'm happy that the docs warn people of the limitations of RAID, especially if it's implemented on top of flaky devices. I find that frequent smartctl health checks of my drives help me to stay on top of drives which are starting to show the sort of errors that lead to out-of-sync mirrors.
Best Answer
The problem is that with the first command you
create
a new logical drive - when finished you will have two LDs, each containing one disk.What you need to do instead is add the unassigned disk to the original RAID0 LD and then invoke the
modify
command.In other words:
And then:
Also consider increasing the rebuild priority before the above steps with:
That should work.