2023.02.26
I came across this post yesterday morning and attempted to implement as I’ve recently (the past week) been having issues with not being able to see newly added files through my fstab nfs mount, even though the files are there on the server. My fstab mount has worked fine for a few years now, with the only thing changing recently is about 1.5 months ago I moved my lab to a different room.
I’ve been off Windows for about 3 years and home labbing for about the same 3 years. I would still consider my Linux knowledge to be very beginner level. Resolving the issues I had with autofs would probably take others much less time. I spent a couple hours between last night and this morning to get it working.
I had quite a few roadblocks, so I’m going to post what worked for me. Perhaps it will help someone else.
Mounting the NFS share from a Proxmox 7.3-6 vm running Ubuntu server version:
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
Exporting the NFS mount from a Proxmox 7.3-6 vm (different node than the Ubuntu server) running openmediavault v6.3.2-1:
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

I followed the original post in this thread to the letter and received the following error.
user@server:~$ ls -l /mnt/nfs/media
ls: cannot access 'media': No such file or directory
total 0
d????????? ? ? ? ? ? media
So I searched Google for a while (lots of wasted time on stack answers and forum posts) and finally came across the Ubuntu wiki entry for autofs (primary sources aren’t my go-to, as it seems they usually assume a higher working knowledge than I have), specifically this portion, as the first part had been covered here.
My /etc/auto.master file ended up the same as posted here. With only the following line appended to the end of it.
/mnt/nfs /etc/auto.nfsdb
My /etc/auto.nfsdb file ended up like this:
media -fstype=nfs4,rw 10.0.0.2:/media
media1 -fstype=nfs4,rw 10.0.0.20:/media1
Per this post “autofs is finicky about executable bits” so I removed everything else. I also switched to nfs4.
Now this still didn’t quite work for me. Somewhere along the way (don’t remember exactly), I discovered the /etc/autofs.conf file. In this file I made the following changes:
Note: I don’t want a timeout, these machines run 24/7. The reason I’m switching to autofs is to hopefully fix whatever is causing the Ubuntu server to not see new files on the NFS mount.
(If any of these are commented out, uncomment)
line 15 timeout = 0
line 54 browse_mode = yes
line 65 mount_nfs_default_protocol = 4
And now it works as expected.
user@server:~$ df -hT
Filesystem Type Size Used Avail Use% Mounted on
10.0.0.2:/media nfs4 37T 35T 1.7T 96% /mnt/nfs/media
10.0.0.20:/media1 nfs4 29T 1.0M 29T 1% /mnt/nfs/media1
user@server:~$ mount | grep nfs
10.0.0.2:/media on /mnt/nfs/media type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.30,local_lock=none,addr=10.0.0.2)
10.0.0.20:/media1 on /mnt/nfs/media1 type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.30,local_lock=none,addr=10.0.0.20)
It’s still quite possible I flubbed the instructions in this guide. But autofs is working for me with these adjustments.
Thank you to OP for the guide.



