}
if (dfd >= 0) close(dfd);
- if (ident->uuid_set &&
+ if (ident->uuid_set && (!update && strcmp(update, "uuid")!= 0) &&
(!super || same_uuid(info.uuid, ident->uuid, tst->ss->swapuuid)==0)) {
if ((inargv && verbose >= 0) || verbose > 0)
fprintf(stderr, Name ": %s has wrong uuid.\n",
struct stat stb2;
fstat(mdfd, &stb2);
info.array.md_minor = minor(stb2.st_rdev);
-
+
+ if (strcmp(update, "uuid")==0 &&
+ !ident->uuid_set) {
+ int rfd;
+ if ((rfd = open("/dev/urandom", O_RDONLY)) < 0 ||
+ read(rfd, ident->uuid, 16) != 16) {
+ *(__u32*)(ident->uuid) = random();
+ *(__u32*)(ident->uuid+1) = random();
+ *(__u32*)(ident->uuid+2) = random();
+ *(__u32*)(ident->uuid+3) = random();
+ }
+ if (rfd >= 0) close(rfd);
+ ident->uuid_set = 1;
+ }
+ memcpy(info.uuid, ident->uuid, 16);
st->ss->update_super(&info, super, update, devname, verbose);
dfd = dev_open(devname, O_RDWR|O_EXCL);
mdadm was insisting the event numbers were identical, but this
isn't needed, and is a problem if the crash was while the metadata
was being updated.
+ - Support --update==uuid
Changes Prior to 2.1 release
- Fix assembling of raid10 array when devices are missing.
argument given to this flag can be one of
.BR sparc2.2 ,
.BR summaries ,
+.BR uuid ,
.BR resync ,
.BR byteorder ,
or
The
.B sparc2.2
-option will adjust the superblock of an array what was created on a Sparc
+option will adjust the superblock of an array what was created on a Sparc
machine running a patched 2.2 Linux kernel. This kernel got the
alignment of part of the superblock wrong. You can use the
.B "--examine --sparc2.2"
assembled. This is not needed on 2.6 and later kernels as they make
this adjustment automatically.
+The
+.B uuid
+option will change the uuid of the array. If a UUID is given with the
+"--uuid" option that UUID will be used as a new UUID and with
+.B NOT
+be used to help identify the devices in the array.
+If no "--uuid" is given, a random uuid is chosen.
+
The
.B resync
option will cause the array to be marked
continue;
if (strcmp(update, "resync")==0)
continue;
+ if (strcmp(update, "uuid")==0)
+ continue;
if (strcmp(update, "byteorder")==0) {
if (ss) {
fprintf(stderr, Name ": must not set metadata type with --update=byteorder.\n");
continue;
}
- fprintf(stderr, Name ": '--update %s' invalid. Only 'sparc2.2', 'super-minor', 'resync' or 'summaries' supported\n",update);
+ fprintf(stderr, Name ": '--update %s' invalid. Only 'sparc2.2', 'super-minor', 'uuid', 'resync' or 'summaries' supported\n",update);
exit(2);
case O(ASSEMBLE,'c'): /* config file */
sb->state &= ~(1<<MD_SB_CLEAN);
sb->recovery_cp = 0;
}
+ if (strcmp(update, "uuid") == 0) {
+ sb->set_uuid0 = info->uuid[0];
+ sb->set_uuid1 = info->uuid[1];
+ sb->set_uuid2 = info->uuid[2];
+ sb->set_uuid3 = info->uuid[3];
+ }
sb->sb_csum = calc_sb0_csum(sb);
return rv;
/* make sure resync happens */
sb->resync_offset = ~0ULL;
}
+ if (strcmp(update, "uuid") == 0)
+ memcmp(sb->set_uuid, info->uuid, 16);
sb->sb_csum = calc_sb_1_csum(sb);
return rv;