(original article)

Re: Converting RAID5 to RAID6 and other shape changing in md/raid

02 August 2010, 22:46 UTC

If you just convert straight to RAID5 with

mdadm /dev/md0 -a /dev/newdev
mdadm --grow /dev/md0 --level=5 --raid-devices=3

then a problem with 'newdev' will mean that you lose redundancy but do not lose your data (until another device failed). A problem with one of the original devices would be harder to recovery from... I'm not sure off hand exactly what would happen, it might survive but as I haven't tested it I cannot be sure.

If you want to be extra safe, I would do the following, assuming the old drives are /dev/A and /dev/B and the new drive is /dev/C, and the array is /dev/md0.

mdadm -S /dev/md0
mdadm -C /dev/md0 -l5 -n2 /dev/A missing -x1 /dev/C
wait for resync
mdadm -G /dev/md0 -n 3
wait for reshape to complete.

Now you have all your data still safe on /dev/A, and assuming nothing has gone wrong, all your data is also safe of /dev/md0 - though the array is degraded. Further you have run a resync and a reshape on /dev/B and /dev/C so you should have some confidence in them.

Now

mdadm /dev/md0 -a /dev/A

This will recover /dev/A which should be safe because we believe /dev/B and /dev/C are healthy having exercised them heavily. If /dev/A has a problem, it will fall out of the array and your data will still be safe.

Though on reflection, I suspect the first option would probably handle errors well.... maybe I should add that to my testing.




[æ]