[systemd-devel] Suppressing automounting

Andrei Borzenkov arvidjaar at gmail.com
Fri Aug 29 21:00:13 PDT 2014

В Fri, 29 Aug 2014 14:59:05 -0400
worley at alum.mit.edu (Dale R. Worley) пишет:

> > From: worley at alum.mit.edu (Dale R. Worley)
> >        When reading /etc/fstab a few special mount options are
> >        understood by systemd which influence how dependencies are
> >        created for mount points from /etc/fstab. [...]  If
> >        x-systemd.device-timeout= is specified it may be used to
> >        configure how long systemd should wait for a device to show up
> >        before giving up on an entry from /etc/fstab. Specify a time in
> >        seconds or explicitly specify a unit as s, min, h, ms.
> > 
> > I haven't tried this yet, but it should suffice for my problem.
> OK, that test failed:  systemd does *not* stop attempting to mount a
> partition after x-systemd.device-timeout has passed.

You misunderstand what happens here. x-systemd.device-timeout sets
*job* timeout - i.e. how long systemd waits when requested to mount
filesystem ("systemctl start Store.mount" in this case).

But when creating mount unit systemd also silently adds dependency to

bor at opensuse:~/src/systemd> systemctl show boot.mount  -p WantedBy --no-pager

Which has the effect that if device was not present at boot but appears
later, the very appearance of device triggers start of mount unit -
filesystem gets mounted.

And yes, this makes semantic very different from
traditional /etc/fstab. And I'm not sure it has to do it by default ...
honestly, I'm not sure it has to do it at all. I think about situation
where I have persistent device names (SAN, iSCSI, LVM) and need to do
maintenance which causes device nodes disappear and appear again. I
definitely do not want any filesystem to be suddenly mounted in this
case until I have finished my tasks.

And of course it is not documented anywhere.

> Here's the line in /etc/fstab:
>     /dev/Freeze02/Store2		/Store         ext4	nofail,x-systemd.device-timeout=1m,defaults	0 0
> And here's /run/systemd/generator/Store.mount:
>     # Automatically generated by systemd-fstab-generator
>     [Unit]
>     SourcePath=/etc/fstab
>     DefaultDependencies=no
>     After=local-fs-pre.target
>     Conflicts=umount.target
>     Before=umount.target
>     [Mount]
>     What=/dev/Freeze02/Store2
>     Where=/Store
>     Type=ext4
>     FsckPassNo=0
>     Options=nofail,x-systemd.device-timeout=1m,defaults

I expected timeout to go in generated unit actually, not in mount

More information about the systemd-devel mailing list