]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Assemble.c
Improve error message when wrong --update option is given.
[thirdparty/mdadm.git] / Assemble.c
index 3c00c9116cbd19d5f9f8b29e0aac8b40b1c022a1..e8fec8e954cb19868351768d2630eb6163b27205 100644 (file)
@@ -421,6 +421,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        }
                        dfd = dev_open(devname, O_RDWR|O_EXCL);
 
+                       remove_partitions(dfd);
+
                        if (super) {
                                free(super);
                                super = NULL;
@@ -460,6 +462,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                        int dfd;
                        dfd = dev_open(devname, O_RDWR|O_EXCL);
 
+                       remove_partitions(dfd);
+
                        if (super) {
                                free(super);
                                super = NULL;
@@ -531,9 +535,12 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
                                        " to have very similar superblocks.\n"
                                        "      If they are really different, "
                                        "please --zero the superblock on one\n"
-                                       "      If they are the same, please remove "
-                                       "one from the list.\n",
-                                       devices[best[i]].devname, devname);
+                                       "      If they are the same or overlap,"
+                                       " please remove one from %s.\n",
+                                       devices[best[i]].devname, devname,
+                                       inargv ? "the list" :
+                                          "the\n      DEVICE list in mdadm.conf"
+                                       );
                                if (must_close) close(mdfd);
                                return 1;
                        }