(original article)

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

09 January 2010, 18:11 UTC

Hi all, I'm converting a 7 disk RAID-5 array to an 8 disk RAID-6 array and wanted to share. Unlike the previous poster, I am not increasing the size of the RAID device, I am simply increasing redundancy.

First of all I made sure I was running mdadm 3.1 or above, which my distro (gentoo) did not have by default. So I installed mdadm 3.1.1, which I believe is current as of the time of this writing.

To add the 8th disk to my existing RAID-5 array, I ran: mdadm --add /dev/md3 /dev/sdh3

this added /dev/sdh3 as a hot spare. Then, to convert this to a RAID-6 array, I ran: mdadm --grow /dev/md3 --level=6 --raid-devices=8 --backup-file=/nfs/media/tmp/md3.backup

Notice the argument is "--raid-devices", not "--raid-disk" as in Neil's post.

I had tried to run the --grow command without the --backup-file argument, as Neil's post seems to say that a backup file is not necessary when a hot spare is present. But mdadm wasn't having it, it told me: mdadm level of /dev/md3 changed to raid6 mdadm: /dev/md3: Cannot grow - need backup-file mdadm: aborting level change

With the --backup-file argument everything seems to be working fine. Here's the relevant part of my /proc/mdstat: md3 : active raid6 sdh3[7] sdg3[6] sdf3[5] sde3[4] sda3[0] sdb3[2] sdc3[3] sdd3[1] 120052224 blocks super 0.91 level 6, 256k chunk, algorithm 18 [8/7] [uuuuuuu_] [=>...................] reshape = 6.3% (1269760/20008704) finish=151.2min speed=2064K/sec

My next step is to convert my 4 terabyte /dev/md5 to a RAID-6 array. Neil wasn't kidding when he said the reshape is a slow process... at the rate that /dev/md3 is converting, I estimate that it will take 4.5 days to convert my /dev/md5 to RAID-6.