D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Linux Mint + systemd + NFS shares

 

Hi All,

This has been a pain ever since Mint changed to systemd. As some will remember I have a Synology NAS with three NFS shares on it. Prior to systemd they were listed in fstab and were available at boot and appeared on the desktop so they could be access automatically. Ever since systemd was introduced the fstab NFS shares have been ignored completely; I could mount the shares manually but they no longer mounted automatically. Having sworn repeatedly at this for over a year and tried various suggested fixes I finally have the following solution.

Install nfs-common - required anyway.

N.B. All below needs to be executed as sudo including file creation.

Create your mount folders, e.g. /media/julian/HESTIA

Create .mount files in /etc/systemd/system - they must be named for the /mount point/ on the target system not the source location, e.g. media-julian-HESTIA.mount not 192.168.1.03-volume1-HESTIA.mount, which is the NFS share. The .mount file then must contain the following:

[Unit]
Description=HESTIA
After=network.target

[Mount]
What=192.168.1.3:/volume1/HESTIA
Where=/media/julian/HESTIA
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target


That only mounts the share on request. Now we need to tell it to auto mount on boot. That is a two stage process:

Create a .automount file in /etc/systemd/system with the same name as above, just a different extension, e.g. media-julian-HESTIA.automount , and then enter the contents as below.

[Unit]
Description=Automount HESTIA NFS [or whatever]

[Automount]
Where=/media/julian/HESTIA

[Install]

WantedBy=multi-user.target


Enable all the mount files or they won't execute at boot, e.g. systemctl enable /etc/systemd/system/media-julian-HESTIA.mount

Then create shortcuts to the AUTOMOUNT files on the Desktop.

Reboot and you should find that just clicking each of your desktop shortcuts will show the share content.

It's not /quite/ perfect as you have to disable the desktop option 'show mounted drives', or the shares show twice when they mount. Likely to be a pain if you commonly swap USB drives and/or optical media, however it's the best I have found until systemd decides to pay attention to the fstab.

Kind regards,

Julian


--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq