Add how to require a systemd mount before starting a service

This commit is contained in:
exu 2023-07-15 16:32:48 +02:00
parent 37e5a9a84b
commit 474b817baa

View File

@ -47,3 +47,17 @@ WantedBy=multi-user.target
Enable the `.automount` file to mount the filesystem when necessary Enable the `.automount` file to mount the filesystem when necessary
`# systemctl enable (target-mount).automount` `# systemctl enable (target-mount).automount`
## Service - require mount
Other services that depend on the filesystem being mounted might have issues with the built-in automounting.
In these cases, the option `RequiresMountsFor=` can be set under the `[Unit]` configuration to ensure a path is mounted.
Paths are space separated
```systemd
[Unit]
...
RequiresMountsFor=[PATH 1] [PATH 2]
```
> [Systemd RequiresMountsFor documentation](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#RequiresMountsFor=)