[PVE-User] Which service is used to mount datacenter NFS Share ?

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jan 4 15:19:42 CET 2017


On Wed, Jan 04, 2017 at 02:50:02PM +0100, Florent B wrote:
> On 01/04/2017 01:54 PM, Fabian Grünbichler wrote:
> > On Wed, Jan 04, 2017 at 01:46:07PM +0100, Florent B wrote:
> >> Hi Fábio,
> >>
> >> Excuse me if my message was not clear enough, but that was not my question.
> >>
> >> I already configured a NFS share.
> >>
> >> I just want to know, when nodes boot, which service (system service) is
> >> mounting those shares ?
> >>
> > IIRC, this happens whenever activate_storage is first called for this
> > storage (e.g. by pvestatd or by pve-manager when starting VMs/CTs on
> > boot):
> >
> > https://git.proxmox.com/?p=pve-storage.git;a=blob;f=PVE/Storage/NFSPlugin.pm;h=2f75eeec0721be3703dbc873568b04c451ad46f7;hb=HEAD#l118
> >
> > mounting an NFS share also generates a systemd .mount unit on the fly,
> > but that does not mean that the mount is triggered by systemd ;)
> >
> > the real question is - what do you want to do?
> >
> 
> Ok, what I want to do is building my systemd dependencies, because I
> need another service to be started before mounting NFS shares (a
> VPN-like thing).

I think that is not currently possible with the NFS storage plugin, as
the mount point is just tracked, but not controlled by systemd.

but I think you should be able to achieve this by creating your own
.mount unit and defining your storage as directory storage in PVE (with
"is_mountpoint" set in /etc/pve/storage.cfg so that it cannot be
activated unless it is mounted). then you can order your "VPN-like
thing" between network-online.target and remote-fs-pre.target:

# systemd-analyze dot show YOUR-NFS-SHARE.mount network-online.target remote-fs.target remote-fs-pre.target | dot -Tsvg > /tmp/deps.svg

or even just directly in relation to your new .mount unit.

note hat remote-fs-pre.target is a "special passive system unit", which
means that the providing unit (= your VPN thing) needs to be
Before=remote-fs-pre.target and Wants=remote-fs-pre.target , but the
consumer (the NFS .mount units in this case) only need
After=remote-fs-pre.target.

the systemd.unit, systemd.mount and systemd.special man pages are
probably helpful if you try to go this route. all of the above is not
tested, so you might run into pitfalls that I overlooked.





More information about the pve-user mailing list