Skip to content

Commit 7e0912d

Browse files
committed
README-internals: add more multipath documentation
This is a complex topic, so let's add more docs.
1 parent 4ccabad commit 7e0912d

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

internals/README-internals.md

+43-15
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,60 @@ For other operating systems which do "per cloud" disk images, it would have been
6666
natural to just change `/etc/chrony.conf` per platform. But that would mean we have a different
6767
ostree commit checksum per platform, breaking our "image based" update model.
6868

69-
# multipath
69+
# Multipath
7070

71-
A lot of history here. A TL;DR is that nontrivial multipath setups conceptually conflict
72-
a bit with the "CoreOS model" of booting into the desired configuration from the start.
73-
There's also a long related issue in that we want to use a "pristine" initramfs in
74-
general, and nontrivial multipath configuration needs to be in the initramfs.
71+
Multipath differs from other storage configurations by a major aspect: it is usually not
72+
configured by Ignition. If we mount an individual path for e.g. `/sysroot`, multipathd will
73+
not be able to take ownership afterwards. Furthermore, directly accessing individual paths
74+
before `multipathd` takes over is unsafe (e.g. it could be a non-optimized path). And since
75+
we need to mount `/boot` very early on, this naturally pushes multipath configuration into
76+
kernel arguments (and ideally soon, initramfs overlays).
7577

76-
What we ended up with is adding an `rd.multipath=default` kernel argument which
78+
What we ended up with is adding an `rd.multipath=default` kernel argument which
7779
triggers dracut to do "basic" automatic multipath setup in the stock initramfs:
7880
https://github.com/dracutdevs/dracut/pull/780
7981

80-
So we still have a model then where the host boots up in a non-multipath
81-
configuration, Ignition runs and the kernel arguments are applied, then we reboot into the
82-
final configuration.
82+
By the nature of multipath, a tricky aspect is that e.g. the `by-label/root` symlink is
83+
valid both *before* and *after* multipathd takes ownership. In order to safely wait for the
84+
multipathed rootfs to show up, we have these udev rules which create, for example,
85+
`by-label/dm-mpath-root`:
86+
87+
https://github.com/coreos/fedora-coreos-config/blob/94e0daa567a658f023d48ac5929c72ed910792bd/overlay.d/05core/usr/lib/udev/rules.d/90-coreos-device-mapper.rules#L1
88+
89+
This is why we require the `root=/dev/disk/by-label/dm-mpath-root` kernel argument; so that
90+
the mount generated by `systemd-fstab-generator` waits for the the multipath version to show
91+
up and doesn't just mount an individual path.
92+
93+
Firstboot (day-1) support is usually done at coreos-installer time by doing:
94+
95+
```
96+
coreos-installer install \
97+
--append-karg rd.multipath=default \
98+
--append-karg root=/dev/disk/by-label/dm-mpath-root \
99+
--append-karg rw
100+
...
101+
```
102+
103+
The `rw` bit is necessary because `systemd-fstab-generator` will create a read-only mount by
104+
default (usually, `rw` is injected by `rdcore rootmap` for subsequent boots, but this does
105+
not happen if there is already a `root` karg).
106+
107+
That said, turning on multipath on a subsequent (day-2) boot is still supported if the
108+
multipath setup itself is compatible with this. This is done by appending the same kargs as
109+
above using e.g. `rpm-ostree kargs`. (Appending the kargs can also be done via
110+
`ignition-kargs`, though this still counts as "day-2" since on first boot we'd still access
111+
the boot partition directly.)
83112

84113
We don't yet document multipath for FCOS, but we do document this setup for
85114
OpenShift that has a kola test:
86115

87-
- https://github.com/coreos/coreos-assembler/blob/60f675ec5037b84c01f17192d773a14166dc6a14/mantle/kola/tests/misc/multipath.go#L57
116+
- https://github.com/coreos/coreos-assembler/blob/f5d003d2ebb81283c3e071ce2ac268884aa7232b/mantle/kola/tests/misc/multipath.go
117+
118+
We also support multipath on an individual non-root partition. See the test above for how
119+
this works.
88120

89121
More links:
90122

91123
- https://github.com/coreos/ignition-dracut/issues/154
92124
- https://bugzilla.redhat.com/show_bug.cgi?id=1944660
93-
94-
95-
An example issue seems to be rooted in our use of labels to find `boot`
96-
and `root`. The labels seem to be racy in our current code because
97-
`multipathd.service` may take over the block devices.
125+
- https://github.com/coreos/fedora-coreos-config/pull/1011

0 commit comments

Comments
 (0)