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

DORMANTno replies

From: Anatoly Pugachev <hidden>
Date: 2020-08-13 16:30:14
Subsystem: the rest · Maintainer: Linus Torvalds

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

Signed-off-by: Anatoly Pugachev <redacted>
---
 Create.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Create.c b/Create.c
index 6f84e5b..99b3701 100644
--- a/Create.c
+++ b/Create.c
@@ -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)
-- 
2.23.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help