[systemd-devel] automount nested nfs share

Marco Giunta giunta at sissa.it
Wed May 4 08:40:28 UTC 2016


Hi at all,
I've a problem with automount features of systemd. I need to mount two 
nfs share in this way:


/srv/nfs		nfs-server.example.com:/share1
/srv/nfs/nested		nfs-server.example.com:/share2


On my old RHEL6 workstation, I used autofs, but now, with a RHEL7 
workstation, I'd like to use systemd.

I've configure two mount units, and they work like a charm: the nfs 
export are mounted like I guess. Then, I've configured an automount unit 
for '/srv/nfs', and it works, BUT when I 've created an unit to 
automount '/srv/nfs/nested', and started it, immediately '/srv/nfs' has 
been mounted, and I cannot unmount it (device is busy).

If I stop '/srv/nfs/nested' automount service, I can unmount '/srv/nfs'. 
I'm trying to figure out the problem, and I think the reason is 
'automatic dependencies':

"""
If an automount unit is beneath another mount unit in the file system 
hierarchy, both a requirement and an ordering dependency between both 
units are created automatically.
"""

in fact:

# systemctl list-dependencies srv-nfs-nested.automount
srv-nfs-nested.automount
   -.mount
   srv-nfs.mount


'srv-nfs-nested.automount' depends on 'srv-nfs.mount'. I don't want 
this, I want the 'srv-nfs-nested.automount' depends on 
'srv-nfs.automount', because I don't want to have '/srv/nfs' always 
mounted, I need to mount it on request, I have more then 300 
workstations to configure.

I've tried to change these settings:

DefaultDependencies = false
Requires=srv-nfs.automount -.mount

but it doesn't works, because 'DefaultDependencies' doesn't disable all 
dependencies:

'''
If set to false, this option does not disable all implicit dependencies, 
just non-essential ones.
'''

So, my question is: is there a way to disable implicit dependencies ?? 
Or is there another way to automount nested nfs share with systemd ??

With autofs, I used a configuration like this:

/srv/nfs	-fstype=nfs4,rw \
		/		nfs-server.example.com:/share1 \
		/nested		nfs-server.example.com:/share2 \
		/nested2	nfs-server.example.com:/share3

and it works as I guess.

Cheers,
   Marco




More information about the systemd-devel mailing list