When killing the superblock, also clear MBR. Signed-off-by: Song Liu <songliubraving@xxxxxx> --- Kill.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Kill.c b/Kill.c index f2fdb85..06ced78 100644 --- a/Kill.c +++ b/Kill.c @@ -28,6 +28,23 @@ #include "mdadm.h" #include "md_u.h" #include "md_p.h" +#include "part.h" + +int KillMBR(int fd) +{ + struct MBR *null_mbr; + + null_mbr = xmalloc(sizeof(*null_mbr)); + memset(null_mbr, 0, sizeof(*null_mbr)); + lseek(fd, 0, 0); + if (write(fd, null_mbr, sizeof(*null_mbr)) != sizeof(*null_mbr)) { + free(null_mbr); + return 1; + } + free(null_mbr); + fsync(fd); + return 0; +} int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) { @@ -76,6 +93,11 @@ int Kill(char *dev, struct supertype *st, int force, int verbose, int noexcl) rv = 0; } } + + if (KillMBR(fd)) + if (verbose >=0) + pr_err("Cannot clear MBR on %s\n", dev); + close(fd); return rv; } -- 2.4.6 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html