mdadm: add new device failed for /dev/xvdl as 2: Invalid argument
I have existing RAID0
setup with two disks. I have to add a new drive to it. But when I try to run the following command:
mdadm --add /dev/md/customer_upload /dev/xvdl
I get an error:
mdadm: add new device failed for /dev/xvdl as 2: Invalid argument
How do I add a new disk to an existing RAID0?
I used the following steps to create RAID 0 initially:
sudo mdadm --create --verbose /dev/md/customer_upload --level=stripe --raid-devices=2 device_name1 device_name2
EDIT
Seems like you cannot add disk to RAID0.
I ran the following command and it made it RAID4
How & Why I am still not clear
/dev/md/customer_upload --grow -l 0 --raid-devices=3 -a /dev/xvdl
I can see three disks in RAID4 but total space is still 2Tb
xvdf 202:80 0 1T 0 disk
└─md127 9:127 0 2T 0 raid4 /customer_upload
xvdg 202:96 0 1T 0 disk
└─md127 9:127 0 2T 0 raid4 /customer_upload
xvdl 202:176 0 1T 0 disk
└─md127 9:127 0 2T 0 raid4 /customer_upload
According to the kernel.org RAID wiki:
After the new disk was partitioned, the RAID level 1/4/5/6 array can be grown
that is, RAID-0 is not eligible for growing. You will need to backup all the data, recreate the array from scratch, and restore from backups.
yes you can, to add one disk to raid 0
mdadm --grow /dev/md0 --level=0 --raid-devices=3 --add /dev/sdd
or you can add several disks
mdadm --grow /dev/md0 --level=0 --raid-devices=4 --add /dev/sdd /dev/sde
raid-devices=4 total devices count with new disks, raid 0 become raid 4 and after reshape will be raid 0 again
and these sysctl opts for reshape speed control dev.raid.speed_limit_min and dev.raid.speed_limit_max