Skip to content

mdraid: assemble md arrays only with mdraid=true - #186

Merged
mastacontrola merged 1 commit into
masterfrom
fix/mdraid-autoassembly
Oct 1, 2026
Merged

mastacontrola merged 1 commit into
masterfrom
fix/mdraid-autoassembly

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Problem

Without mdraid=true, FOS still assembles md arrays at boot. The array holds its member partitions, and capture fails at "Reading Partition Tables...Failed / Could not find partitions". Forums topic 18202 shows md126/md127 on nvme0n1p2/p3 with no mdraid on the command line.

Cause

Buildroot installs mdadm's udev rules when eudev is the device manager. 64-md-raid-assembly.rules runs mdadm --incremental on every RAID member at coldplug. S99fog's mdraid == true gate never applied to udev.

Fix

  • etc/udev/rules.d/64-md-raid-assembly.rules masks mdadm's /lib rule. It is a copy of mdadm 4.3's rule with a gate on mdraid=true from the kernel command line.
  • S99fog runs mdadm --stop --scan when the flag is off. This releases arrays from the kernel's own v0.90 autodetect.
  • With mdraid=true, behavior does not change.

Verification

QEMU, built x64 init, RAID1 (md 1.2) on sda1+sda2, udev coldplug through the real S10udevd:

Init Command line Result
master no flag md0 active, holds sda1 and sda2 (the bug)
this branch no flag no array, no holders
this branch mdraid=true md0 active, as before

tests/checks/mdraid-gate.sh -b passes. I made it fail on each defect: gate removed, copy drifted from upstream, S99fog stop removed, mask file removed.

Not tested: a full capture on real NVMe, and the S99fog stop path (needs a v0.90 array on a type-fd partition).

🤖 Generated with Claude Code

FOS assembles arrays in S99fog only when the kernel command line carries
mdraid=true. But Buildroot installs mdadm's udev rules whenever eudev is
the device manager. 64-md-raid-assembly.rules runs "mdadm --incremental"
on every RAID member at coldplug, so arrays assembled without the flag.
The array holds its member partitions, and capture stops at "Reading
Partition Tables...Failed / Could not find partitions" (forums 18202).

The overlay now masks that rule with a copy gated on mdraid=true. S99fog
also stops any array when the flag is off, which covers the kernel's own
v0.90 autodetect. With mdraid=true nothing changes.

Verified in QEMU with the built x64 init and a RAID1 on sda1+sda2:
old init, no flag: md0 active, holds sda1 and sda2 (the bug)
new init, no flag: no array, no holders
new init, mdraid=true: md0 active, as before

tests/checks/mdraid-gate.sh guards the mask, the gate order, the S99fog
branch, and with -b that the copy still matches the installed rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit 3e6ad80 into master Oct 1, 2026
1 check passed
@mastacontrola
mastacontrola deleted the fix/mdraid-autoassembly branch October 1, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant