mdadm RAID5 to RAID6 migration

This is obviously more aggressive than a sane person should try to do in one grow, but as you can see it’s very straightforward. First, let’s create a quick five disk RAID5 array. This requires mdadm 3.1.4 or greater.

 mdadm --create --verbose /dev/md0 --level=5 --raid-devices=5 /dev/sd[bcdef]1

Next, we’ll migrate this to a 10 disk array. First add 5 disks as spares.

 mdadm --add /dev/md0 /dev/sd[ghijk]1

Next, we’ll grow the array by 5 disks and change the RAID level.

 mdadm --grow /dev/md0 --level=6 --raid-devices=10 --backup-file=/md0.backup

Next, if the array is mounted, unmount it.

 umount /storage/

Run a filesystem check.

 fsck.ext4 -f /dev/md0

Grow, the filesystem to take advantage of the new space.

 resize2fs /dev/md0

Finally, update the mdadm.conf file.

 echo "DEVICE partitions" > /etc/mdadm/mdadm.conf echo "HOMEHOST fileserver" >> /etc/mdadm/mdadm.conf echo "MAILADDR  youruser@gmail.com" >> /etc/mdadm/mdadm.conf mdadm --detail --scan >> /etc/mdadm/mdadm.conf

Finally, mount your new, much larger array.

 mount -a

Zack

I love learning new things and trying out the latest technology.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.