[systemd-devel] systemd.mount - How to disable the auto-creation of the directory (directories)

Lennart Poettering lennart at poettering.net
Thu Oct 20 07:52:35 UTC 2022


On Do, 20.10.22 09:18, kAja Ziegler (ziegleka at gmail.com) wrote:

> Hello,
>
> Is there any way to turn off the automatic directory (directories) creation
> during mount unit start/run? To make the [auto-generated] mount unit behave
> the same as the mount command - to end with an error?

Add a .mount drop-in for your unit that sets AssertPathExists= to your
path in the [Unit] section.

i.e. create /etc/systemd/system/mnt-x.mount.d/50-myassert.conf, and
add:

    [Unit]
    AsserPathExists=/mnt/x

into it.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list