Hi!

Thanks for reporting this problem and digging further!

[...]
> 
> When launching it by hand I get:
> # mdadm --create /dev/md1 --level=raid0 --force --run --raid-devices=2 
> --spare-devices=0 /dev/sda3 /dev/sdb3
> mdadm: spare-devices setting is incompatible with raid level 0
> 
> and without the spare-devices option, it works perfectly:
> # mdadm --create /dev/md1 --level=raid0 --force --run --raid-devices=2 
> /dev/sda3 /dev/sdb3
> mdadm: /dev/sda3 appears to contain an ext2fs file system
>     size=10490240K  mtime=Mon Dec  8 17:34:30 2008
> mdadm: /dev/sda3 appears to be part of a raid array:
>     level=raid0 devices=2 ctime=Mon Dec  8 17:34:24 2008
> mdadm: /dev/sdb3 appears to be part of a raid array:
>     level=raid0 devices=2 ctime=Mon Dec  8 17:34:24 2008
> mdadm: array /dev/md1 started.
> 
> I made this very quick and dirty patch:
> --- Commands.pm.orig    2008-12-08 15:56:58.000000000 +0100
> +++ Commands.pm 2008-12-08 17:33:23.000000000 +0100
> @@ -224,7 +224,7 @@
>        $pre_req =~ s/^,//;
>        &FAI::push_command(
>          "yes | mdadm --create /dev/md$id --level=$level --force --run 
> --raid-devices="
> -          . scalar(@eff_devs) . " --spare-devices=" . scalar(@spares) . " "
> +          . scalar(@eff_devs) . (scalar(@spares) !=0 ? " --spare-devices=" . 
> scalar(@spares) : "") . " "
>            . join(" ", @eff_devs) . " " . join(" ", @spares),
>          "$pre_req", "exist_/dev/md$id" );
>
[...]

Hmm, looking at the mdadm code it rather seems that it is not that the option
must be removed if the number of spare devs is 0, but rather spare-devices must
not be used at all with raid 0. I'll try to come up with a patch that resolves
parts of this issue while parsing already.

Thanks again,
Michael





Attachment: pgp43APFgs5Le.pgp
Description: PGP signature

Reply via email to