Skip to contentSkip to conversation

mdadm/Create: Be more verbose on the RAID array create failure.

PATCH New Anatoly Pugachev 1 participant 1 message Aug 13, 2020 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mdadm/Create: Be more verbose on the RAID array create failure.

Be more verbose on the RAID array create failure. Give a hint to check with the kernel messages on an error.

For example (with missing CONFIG_MD_RAID1 in the kernel config) :

$ ./mdadm --create /dev/md1 --raid-devices=2 --level=1 --spare-devices=0 missing /dev/sdb3
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: Check last messages in the kernel log. RUN_ARRAY failed: Invalid argument
$ journalctl -k -e
Aug 13 15:46:05 lifshitz kernel: md: personality for level 1 is not loaded!
Aug 13 15:46:05 lifshitz kernel: md: md1 stopped.

vs (current version):

$ mdadm --create /dev/md1 --raid-devices=2 --level=1 --spare-devices=0 missing /dev/sdb3
...
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: RUN_ARRAY failed: Invalid argument
---
 Create.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Create.c +1 -1
index 6f84e5b..99b3701 100644
@@ -1052,7 +1052,7 @@ int Create(struct supertype *st, char *mddev,
 			/* param is not actually used */
 			mdu_param_t param;
 			if (ioctl(mdfd, RUN_ARRAY, &param)) {
-				pr_err("RUN_ARRAY failed: %s\n",
+				pr_err("Check last messages in the kernel logs. RUN_ARRAY failed: %s\n",
 				       strerror(errno));
 				if (errno == 524 /* ENOTSUP */ &&
 				    info.array.level == 0)
Signature · 1 line
2.23.0