[systemd-devel] [PATCH] fstab-generator: add x-systemd.{after, requires-mounts-for}=

Andrei Borzenkov arvidjaar at gmail.com
Tue May 12 09:29:33 PDT 2015

В Tue, 12 May 2015 18:04:50 +0200
Karel Zak <kzak at redhat.com> пишет:

> Currently we have no way how to specify dependencies between fstab
> entries (or another units) in the /etc/fstab. It means that users are
> forced to bypass fstab and write .mount units manually.

Actually we have.

mkdir -p /etc/systemd/system/path-to-mount-point.mount.d
cat > /etc/systemd/system/path-to-mount-point.mount.d/deps.conf << EOF

> Years ago Lennart suggested to add

Well, years ago we did not have drop-ins.

> x-systemd.after=<PATH>
>  - to specify dependence an another mount (PATH is translated to <PATH>.mount)
> x-systemd.after=<UNIT>
>  - to specify dependence on arbitrary UNIT
> The x-systemd.after= is implemented by After= and Requires=.
> x-systemd.requires-mounts-for=<PATH ...>
>  - to specify dependence on another paths, implemented by
>    RequiresMountsFor=.
> For example two bind mounts where B depends on A:
>  /mnt/test/A    /mnt/test/A     none    bind,defaults
>  /mnt/test/A    /mnt/test/B     none    bind,x-systemd.after=/mnt/test/A
> More complex example with overlay FS where one mount point depends on
> "low" and "upper" directories:
>  /dev/sdc1   /mnt/low    ext4     defaults
>  /dev/sdc2   /mnt/high   ext4     defaults
>  overlay     /mnt/merged overlay  lowerdir=/mnt/low,upperdir=/mnt/high/data,workdir=/mnt/high/work,x-systemd.requires-mounts-for=/mnt/low\040/mnt/high

All examples can be configured using drop-ins. Do we really need yet
another syntax now?

More information about the systemd-devel mailing list