They do nothing but cause confusion.
}
dfd = dev_open(devname, O_RDWR|O_EXCL);
+ remove_partitions(dfd);
+
if (super) {
free(super);
super = NULL;
int dfd;
dfd = dev_open(devname, O_RDWR|O_EXCL);
+ remove_partitions(dfd);
+
if (super) {
free(super);
super = NULL;
- 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
fstat(fd, &stb);
disk.major = major(stb.st_rdev);
disk.minor = minor(stb.st_rdev);
+ remove_partitions(fd);
close(fd);
}
switch(pass){
close(dfd);
continue;
}
+ remove_partitions(dfd);
close(dfd);
break;
}
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);
#include "md_p.h"
#include <sys/utsname.h>
#include <ctype.h>
+#include <linux/blkpg.h>
/*
* Parse a 128 bit uuid in 4 integers
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)
{