]> git.ipfire.org Git - thirdparty/systemd.git/commit
repart: try harder to find OS prefix
authorLennart Poettering <lennart@poettering.net>
Fri, 26 Mar 2021 15:26:32 +0000 (16:26 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Apr 2021 16:53:15 +0000 (18:53 +0200)
commita73b2ad041469bf20e3771725dcf70069451e116
tree080e81e014dfdc50d244d291b7d5664d73cf3779
parentee7561d014d073944779e155271d7042d7ea5572
repart: try harder to find OS prefix

This teaches repart to look for the root block device both as the
backing for /sysroot and for /sysusr/usr.

The latter is a new addition, and starts making more sense with the next
commit. It's about supporting systems that are shipped with only a /usr/
fs, but where a root fs is allocated and formatted on first boot via
systemd-repart (or a similar tool). In this case it's useful to be able
to mount the ultimate /usr/ early on without mounting the root fs
right-away (simple because the rootfs might not exist yet, and we need
the repart data encoded in /usr/ to actually format it). Hence, instead
of requiring that we mount /sysroot/ first and /sysroot/usr/ second as
we did so far, let's rearrange things slightly:

1. We mount the /usr/ file system we discover to /sysusr/usr/
2. We mount the root file system we discover to /sysroot/
3. Once both are established we bind mount /sysusr/usr/ to /sysroot/usr/

And that' it. The first two steps can happen in either order, and we can
access /usr/ with or without a rootfs being around.

This commit implements nothing of the above. Instead, it teaches
systemd-repart to check both /sysroot/ and /sysusr/ for repart drop-ins,
and use the first of these hierarchies it finds populated. This way
systemd-repart can be spawned once /usr is mounted and it will work
correctly without root fs having to exist, or we can invoke it when the
root fs is already mounted, where it also will work correctly.
src/partition/repart.c