Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: [patch] [ok?] bioctl: disallow -c 1C with only one chunk (as per man page)
To:
Alexander Klimov <a@kli.mov>
Cc:
tech@openbsd.org
Date:
Fri, 26 Apr 2024 14:47:26 +0200

Download raw body.

Thread
On Fri, Apr 26, 2024 at 01:36:47PM +0200, Alexander Klimov wrote:
> On 26.04.24 11:53, Stefan Sperling wrote:
> > With your diff there is no way to recover from a broken chunk.
> 
> Indeed, bioctl -c also assembles *existing* (detached via -d) RAIDs.
> At least 1C ones. Thank you! Was curious how to do that.
> 
> But then shouldn't one be able to do that with other disciplines as well?
> If one should, shall I create a new patch for this?
> 
> > 
> > > --- /usr/src/sbin/bioctl/bioctl.c
> > > +++ /usr/src/sbin/bioctl/bioctl.c
> > > @@ -857,8 +857,10 @@
> 
> E.g. RAID 5 here consists of at least 2 chunks when degraded,
> but not yet failed, and one more when ok.
> But this line demands at least 3 chunks.
> I.e. I couldn't assemble a degraded RAID 5 with 2 (3) chunks.

There is some auto-assembly code in the kernel which runs at boot-time
and does assemble volumes in degraded state. AFAIK this is currently
the only way to assemble degraded volumes of types other than RAID 1C.

Which is annoying because it requires a reboot after e.g. plugging an
external disk that was part of a failed RAID 1 or RAID 5 into another
machine.

I agree that bioctl should allow attaching any volumes in degraded state
at run-time, like it does for RAID 1C.  The min_disks check should of
course still apply when a volume is initially created. But this check
needs to be done in the kernel, as bioctl doesn't know the volume's state.