[systemd-devel] Suppressing automounting

Andrei Borzenkov arvidjaar at gmail.com
Sun Sep 14 10:01:34 PDT 2014


В Thu, 4 Sep 2014 18:32:20 -0400
worley at alum.mit.edu (Dale R. Worley) пишет:

> > From: Andrei Borzenkov <arvidjaar at gmail.com>
> 
> > bor at opensuse:~/src/systemd> systemctl show boot.mount  -p WantedBy --no-pager
> > WantedBy=dev-sda1.device
> > 
> > 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.
> 
> I admit that I haven't studied systemd enough to understand the
> significance of WantedBy.  My understanding is that systemd performs a
> series of units, with dependencies showing which units must finish
> before other units start.

There are several types of dependencies; ordering is just one of them.
Please see "man systemd.unit" for full list. In this case WantedBy
means that when dev-sda1.device is started, systemd automatically
starts boot.mount. For a device unit "started" means systemd was
notified by udev that device had appeared (a bit simplified).

>                           But it appears that boot.mount does not
> represent a particular task, but some sort of generic task that is
> executed multiple times, one for each ".device" unit. -- Or is "boot"
> the name of the mountpoint, and "boot.mount" only represents the work
> for mounting /dev/sd1 as /boot?
> 

Correct. boot.mount represents /boot mountpoint which in my case
resides on /dev/sda1. So above dependency means that when /dev/sda1
appears systemd tries to start boot.mount; and starting mount unit
means mounting it ...

> However, if I wanted to add an option that means "give up on
> attempting to mount this device after xx seconds", what would be a
> good way to organize it, given the architecture of systemd?

And once again - systemd *does* give up after xx seconds once it
initiated start of mount unit. Even without any explicit option (90
seconds is default timeout).

>                                                             It
> appears that there is a general mechanism for inserting information
> for systemd into the "options" part of an /etc/fstab line, so
> presumably the indication for the option would be placed there.
> 
> In my "Store.mount" file, I see no indication of an executable which
> implements the unit.  What is the code which implements it?

systemd binary, like any other unit. Code is in git on fdo.

>                                                             Would it
> be possible for that code to determine how long it has been?
> 

You have too many "it"s in this sentence; could you rephrase? But
systemd already has default timeout for any unit. You are looking in
the wrong place.

> Dale



More information about the systemd-devel mailing list