diff options
-rw-r--r-- | Assemble.c | 4 | ||||
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Create.c | 1 | ||||
-rw-r--r-- | Manage.c | 1 | ||||
-rw-r--r-- | mdadm.h | 1 | ||||
-rw-r--r-- | util.c | 20 |
6 files changed, 31 insertions, 0 deletions
@@ -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; @@ -7,6 +7,10 @@ Changes Prior to this release - Fix endian problem with 'bitmap' metadata - Allow a number (of partitions) after the 'yes' option to --auto= This is particularly useful in the 'create' line in mdadm.conf. + - Remove partitions from any whole device that is made part of + an md array. This is a work-around for annoying messages + when the first block on some drive accidentally looks like a + partition table. Changes Prior to 2.5.3 release - Document v0.91 superblocks in md.4 @@ -521,6 +521,7 @@ int Create(struct supertype *st, char *mddev, int mdfd, fstat(fd, &stb); disk.major = major(stb.st_rdev); disk.minor = minor(stb.st_rdev); + remove_partitions(fd); close(fd); } switch(pass){ @@ -259,6 +259,7 @@ int Manage_subdevs(char *devname, int fd, close(dfd); continue; } + remove_partitions(dfd); close(dfd); break; } @@ -460,6 +460,7 @@ extern int enough(int level, int raid_disks, int layout, char *avail, int avail_disks); extern int ask(char *mesg); extern unsigned long long get_component_size(int fd); +extern void remove_partitions(int fd); extern char *human_size(long long bytes); @@ -31,6 +31,7 @@ #include "md_p.h" #include <sys/utsname.h> #include <ctype.h> +#include <linux/blkpg.h> /* * Parse a 128 bit uuid in 4 integers @@ -118,6 +119,25 @@ int get_linux_version() return (a*1000000)+(b*1000)+c; } +void remove_partitions(int fd) +{ + /* remove partitions from this block devices. + * This is used for components added to an array + */ +#ifdef BLKPG_DEL_PARTITION + struct blkpg_ioctl_arg a; + struct blkpg_partition p; + + a.op = BLKPG_DEL_PARTITION; + a.data = (void*)&p; + a.datalen = sizeof(p); + a.flags = 0; + memset(a.data, 0, a.datalen); + for (p.pno=0; p.pno < 16; p.pno++) + ioctl(fd, BLKPG, &a); +#endif +} + int enough(int level, int raid_disks, int layout, char *avail, int avail_disks) { |