[systemd-devel] Two conditional mount units for the same mount point
Jan Kundrát
jan.kundrat at cesnet.cz
Tue Oct 24 15:27:01 UTC 2017
I would like to mount one of two partitions to a common mount point based
on an option passed on the kernel's command line. I tried to implement this
with two cfg-A.mount and cfg-B.mount units with an appropriate
ConditionKernelCommandLine=... stanzas, but this did not work because a
.mount unit apparently needs to have a name which exactly matches its
mountpoint. I don't know how I can have two units with a different content
sharing the same unit name, though.
Here's my cfg-A.mount, the other one was very similar:
> [Unit]
> Description=Persistent configuration: slot A
> ConditionKernelCommandLine=rauc.slot=A
> DefaultDependencies=no
> Conflicts=umount.target
> Before=local-fs.target umount.target
> After=swap.target
>
> [Mount]
> What=/dev/mmcblk0p2
> Where=/cfg
> Type=auto
> Options=relatime,nosuid,nodev
In the end, I kinda-solved this by a custom oneshot service which simply
calls `mount` explicitly, but that's probably not a very systemd-ish
solution.
How should I solve this elegantly?
With kind regards,
Jan
More information about the systemd-devel
mailing list