There's no way to clear the --write-mostly flag in a RAID 1 device without clearing the superblock: mdadm --add /dev/mdN --write-mostly /dev/sdaN mdadm --fail /dev/mdN /dev/sdaN mdadm --remove /dev/mdN /dev/sdaN mdadm --add /dev/mdN /dev/sdaN mdadm --examine /dev/sdaN | grep write-mostly # huh? mdadm --fail /dev/mdN /dev/sdaN mdadm --remove /dev/mdN /dev/sdaN mdadm --zero-superblock /dev/sdaN mdadm --add /dev/mdN /dev/sdaN mdadm --examine /dev/sdaN | grep write-mostly # aah! This is all right in theory, but if you're using bitmaps that would speed up the resync, zeroing the superblock defeats it.
FTR, I sent a proposed (untested) patchlet to Neil Brown: diff .prev/Manage.c ./Manage.c --- .prev/Manage.c +++ ./Manage.c @@ -397,6 +397,8 @@ int Manage_subdevs(char *devname, int fd disc.state = mdi.disk.state; if (dv->writemostly) disk.state |= 1 << MD_DISK_WRITEMOSTLY; + else + disk.state &= ~(1 << MD_DISK_WRITEMOSTLY); if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) { if (verbose >= 0) fprintf(stderr, Name ": re-added %s\n", dv->devname);
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle. Changing version to '10'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Neil wrote me back some time ago mentioning he'd probably add this feature, but in a slightly different way. In the mean time, I found out it's possible to clean the writemostly flag of a running md array by writing '-writemostly' to /sys/block/md${N}/md/dev-${component}/state.