D&C GLug - Home Page

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

Re: [LUG] Linux Mint 20 and autofs [trying to mount NFS shares on NAS]

 

On 15/07/2020 21:47, Julian Hall wrote:
On 15/07/2020 19:38, comrade meowski wrote:
On 15/07/2020 15:28, Julian Hall wrote:
Hi All,

The little so-n-so is not working, despite following various instructions online to the letter regarding editing auto.master and creating a second file; mine is called auto.nfsdb. Mint is Ubuntu based btw. It doesn't help that for some reason advice varies on how to set it up. That includes how to start the autofs service in the first place. To my mind there should be /one/ way to set it up not variants.

nfs-common and autofs are installed.

Host is 192.168.1.3 [or is named Zeus] and has three shares on /volume1

DEMETER, HESTIA and PERSEPHONE

Thoughts appreciated.

DEJA VU!

Indeed.. for some reason the exact same steps (and OS version) I use on my desktop to mount the NAS shares do not work on my Lenovo x201 laptop. As it wasn't working /anyway/, and the laptop is rarely used except for testing I wiped it clean and installed Mint 20. I then saw that autofs seemed to be the 'proper' way to mount the shares as desired, so I did some research on how, and did the following:

apt-get install autofs
sudo vi /etc/auto.master

From here on the forums / websites vary, and this is where my braincell starts to itch..

One source says to add this line '/media/julian/nfs /etc/auto.nfsdb --timeout=30 --ghost' and let autofs create the mount points, but another says to put the actual mount point which in my case is /media/julian/DEMETER (etc)

At the moment my /etc/nfsdb file reads as follows:

DEMETER -fstype=nfs4,rw Zeus:/volume1/DEMETER
HESTIA -fstype=nfs4,rw Zeus:/volume1/HESTIA
PERSEPHONE -fstype=nfs4,rw Zeus:/volume1/PERSEPHONE

[I have also tried 192.168.1.3 as host, and Zeus:/DEMETER with no change in result. The Synology NAS does have v4 enabled for NFS.]

I am then supposed to restart the autofs service and it will work. So I enter 'sudo systemctl restart autofs.service'. Sure enough the mount point appears on the desktop, but on opening it - even after a reboot - it's empty. Also even with all three mount points in /etc/nfsdb only one ever appears on the desktop.

As usual I am scratching my head so thought I ought to ask the experts for advice.

Kind regards,

Julian


I expect as usual there will be some back and forth where it turns out there are a bunch of weird things going on that don't make sense at your end and that this problem isn't really a problem at all. I dimly remember you having weird and entirely arbitrary desires for things like desktop shortcuts and other stuff. Don't you have some weird insistence that it has to mount at early boot instead of on-demand?

From muscle memory I just did this on a spare Pop OS VM:

1: sudo apt install nfs-common
2: sudo mkdir /mnt/nfs
3: add this to /etc/fstab:

failbot:/export/ISO     /mnt/nfs        nfs auto,nofail,noatime,nolock,intr,tcp 0 0

4: sudo mount /mnt/nfs

Done. That's it. After a reboot, the nfs share is available at /mnt/nfs with no automount shenanigans. For those you need the various x-systemd.automount and similar fstab options which I always have to stop and look up.

It's also not how I'd do it now - that's just pure muscle memory from having set it up a million times over the years (if I'd cheated and looked in another couple of VM's fstabs I could've pinched some better fstab options like timeout and so on).

How you _should_ do it on a modern system - presuming systemd - is with a systemd mount unit and optionally an accompanying automount unit. Arch as per usual has better documentation than Ubuntu:

https://wiki.archlinux.org/index.php/NFS

What you don't want to do is make things more complicated than they need to be - get rid of autofs for a start.

Far more importantly though, didn't we waste a lot of time on this before before eventually deciding that there was something strange going on with your NFS server? My NFS server is a well behaved and correctly configured Linux system. Didn't your Synology have known weird issues to work around?

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