Molle Bestefich wrote:
> Neil Brown wrote:
> > > How do I force MD to raise the event counter on sdb1 and accept it
> > > into the array as-is, so I can avoid bad-block induced data
> > > corruption?
> >
> > For that, you have to recreate the array.
>
> Scary. And hairy.
> How much do I have to bribe you to make this work:
>
> # mdadm --assemble /dev/md1 --force /dev/sd{a,b,c,d,e,f}1
>
> Not now, that is, but for the sake of future generations? :)
I crossed my fingers and dived into the code.
The mdadm code was super well written - Thanks, Neil :-) - so
conjuring up a patch took less than 5 minutes.
Patch attached - does it look acceptable for inclusion in mainline?
With the patch, I can do this:
# mdadm --assemble /dev/md1 --force /dev/sd{a,b,c,d,e,f}1
mdadm: forcing event count in /dev/sdb1(1) from 160264 upto 163368
mdadm: clearing FAULTY flag for device 1 in /dev/md1 for /dev/sdb1
mdadm: /dev/md1 has been started with 6 drives.
And have the array started with all 6 devices (as I've asked it for).
--- Assemble.c.ok 2006-04-18 02:47:11.000000000 +0200
+++ Assemble.c 2006-04-18 01:18:38.000000000 +0200
@@ -119,6 +119,7 @@
struct mdinfo info;
char *avail;
int nextspare = 0;
+ int devs_on_cmdline = devlist!=NULL;
vers = md_get_version(mdfd);
if (vers <= 0) {
@@ -407,9 +408,10 @@
sparecnt++;
}
}
- while (force && !enough(info.array.level, info.array.raid_disks,
+ while (force && ((!enough(info.array.level, info.array.raid_disks,
info.array.layout,
- avail, okcnt)) {
+ avail, okcnt)) ||
+ (devs_on_cmdline && (num_devs > okcnt)))) {
/* Choose the newest best drive which is
* not up-to-date, update the superblock
* and add it.