NFS systemd
Mounting points
IP addresses
local: 192.168.1.16
remote: 192.168.1.191
1) We will mount
Source: remote:/srv/share/app/docs
Destination: local:/srv/app/static/data/docs
2) We will mount
Source: local:/srv/app/static/data/docs
Destination local:/var/app/app/static/data/docs
Mount remote: in local:
/etc/fstab:
-----------
...
192.168.1.191:/srv/share/app/docs /srv/app/static/data/docs nfs noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
Since the fstab will not be loaded until we reboot the host, we can mount it manually:
_$: mount \
-t nfs \
-o noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min \
192.168.1.191:/srv/share/app/docs /srv/app/static/data/docs
Mount local: in local:
/lib/systemd/system/var-app-app-static-data-docs.mount:
-------------------------------------------------------
[Unit]
Description=App docs shared directory
After=network.target
[Mount]
What=/srv/app/static/data/docs
Where=/var/app/app/static/data/docs
Options=bind
[Install]
WantedBy=multi-user.target
_$: systemctl enable var-app-app-static-data-docs.mount
_$: systemctl reload var-app-app-static-data-docs.mount