mdadm: add new device failed for /dev/xvdl as 2: Invalid argument
Solution 1
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.
Solution 2
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
Related videos on Youtube
Ut xD
Updated on September 18, 2022Comments
-
Ut xD over 1 year
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
-
Ut xD over 9 yearsI did
mdadm /dev/md/customer_upload --grow -l 0 --raid-devices=3 -a /dev/xvdl
and it made my setupRAID4
, I can see all the three disks attached usinglsblk
but total space is still 2Tb. How to resolve this? It should be 3Tb since each disk is of 1Tb -
MadHatter over 9 yearsFirstly, are you sure it changed the RAID level? Can you cut-and-paste the output of
cat /proc/mdstat
into your question? Secondly, have you grown the FS to fill the device? You keep telling us you know things ("total space is still 2Tb") but you don't show us how you know them, which makes it difficult to comment. -
Ut xD over 9 yearsadded to question
-
MadHatter over 9 yearsA three-1TB-stripe RAID-4 should be 2TB usable (2 data 1 parity), which is what you say you see. You need this to be a 3-stripe RAID-0, and I still think that means you'll need to backup, nuke, recreate, and restore.
-
Ut xD over 9 yearsHow much space would I require for parity in RAID5?
-
MadHatter over 9 yearsThe same; the only difference is that the parity blocks are striped across all three drives in 5, as opposed to all on one disc in 4.