mdadm 3.0.2 with kernel 2.6.31-gentoo-r4 fails to grow a raid 5 array. mdadm 3.1 with kernel 2.6.31-gentoo-r4 will grow raid 5 arrays and adds the capability to re-stripe raid5 to raid6. Reproducible: Always Steps to Reproduce: #!/bin/bash # -e function create_block { # SizeMB , Name dd if=/dev/zero bs=1024k count="$1" of="$2" } function setup_blockdevs { # count, Name ii_setup_bd=0; while [[ $ii_setup_bd -lt $1 ]] do cp "$2" "$2"."$ii_setup_bd" devs[$ii_setup_bd]=`losetup -f --show "$2"."$ii_setup_bd"` ii_setup_bd=$(($ii_setup_bd + 1)) done } function print_list { # list while [[ -n "$1" ]] do echo $1 shift done } function delete_blockdevs { # list, shifted out while [[ -n "$1" ]] do #echo rm $1 losetup -d $1 shift done } create_block 33 test_devs setup_blockdevs 6 test_devs ## Create array, raid 0 mdadm --create /dev/md90 -e 1.2 -c 64 --verbose --level=5 --raid-devices=3 ${devs[0]} ${devs[1]} ${devs[2]} uuid=`mdadm --detail /dev/md90 | awk '/UUID/ {print $3}'` echo "$uuid" #sleep 5 if [[ -z "$uuid" ]] ; then exit ; fi ## Create filesystem and test data mkfs.ext4 /dev/md90 mkdir "/tmp/test$uuid" mount /dev/md90 "/tmp/test$uuid" pushd "/tmp/test$uuid" dd if=/dev/urandom of="random-data" bs=1024k count=10 popd umount "/tmp/test$uuid" ## test mount /dev/md90 "/tmp/test$uuid" pushd "/tmp/test$uuid" md5sum -b random-data > random-data.md5 md5sum -c *.md5 popd umount "/tmp/test$uuid" ## grow mdadm --add /dev/md90 ${devs[3]} mdadm --detail /dev/md90 echo "Trying to grow RAID5 by one device" mdadm --grow /dev/md90 --level=5 -n4 mdadm --detail /dev/md90 sleep 5 ## test mount /dev/md90 "/tmp/test$uuid" pushd "/tmp/test$uuid" md5sum -b random-data > random-data.md5 md5sum -c *.md5 popd umount "/tmp/test$uuid" ## grow mdadm --add /dev/md90 ${devs[4]} mdadm --detail /dev/md90 echo "Trying to grow RAID5 by one device to RAID6" mdadm --grow /dev/md90 --level=6 -n5 mdadm --add /dev/md90 ${devs[5]} mdadm --detail /dev/md90 echo "Trying to grow RAID6 by one device, or RAID5 by two to RAID6 (or if that returns failure, just raid 5)" mdadm --grow /dev/md90 --level=6 -n6 || mdadm --grow /dev/md90 --level=5 -n6 mdadm --detail /dev/md90 sleep 5 ## test mount /dev/md90 "/tmp/test$uuid" pushd "/tmp/test$uuid" md5sum -b random-data > random-data.md5 md5sum -c *.md5 popd umount "/tmp/test$uuid" sleep 5 mdadm --stop /dev/md90 delete_blockdevs ${devs[@]} unset uuid unset devs unset ii_setup_bd rm test_devs* exit See the linked URL ( http://www.kernel.org/pub/linux/utils/raid/mdadm/ ) for upstream versions.
it isnt really "mdadm-3.0.2 fails to grow a raid 5 array" as it never supported it in the first place added both 3.1 and 3.0.3 to the tree
I remember mdadm was able to grow raid5 arrays before; however it was not previously able to complete a raid6 takeover of a raid5 array.