Mounting nfs shares with autofs

I will show you here to automount nfs shares under bluefin.

Open the terminal and give the command:

sudo rpm-ostree install autofs

Reboot your computer and then continue.

.
.
.
.

showmount -e ip_adress_of_your_nfs_server

The result will be something as:

Export list for 192.168.0.177:
/storage 192.168.0.0/255.255.255.0

The storage on that computer contains a directory TV and Movies.

Now I need to now where I want to mount this shares. I choose a directory named nfs.

command:
sudo mkdir /var/mnt/nfs
sudo chown -R root:$USER /var/mnt/nfs
sudo chmod 775 /var/mnt/nfs

Now change to the directory /etc and execute follow commands.

sudo nano auto.master
at the end of that file add:

/var/mnt/nfs /etc/auto.nfs --ghost --timeout=60

save and exit the file

sudo nano auto.nfs (creating a new file)

add content from your showmount output.
#Export list for 192.168.0.177:
#/storage 192.168.0.0/255.255.255.0

This is only comment to remember your share.

Now I will mount my TV and Movies folders. Follow the syntax.

series -fstype=nfs4,rw 192.168.0.177:/storage/TV
films -fstype=nfs4,rw 192.168.0.177:/storage/Movies

this wil mount my nfs share under series in /var/mnt/nfs
and my Movies under /var/mnt/films

Now in the terminal give the command:

sudo systemctl enable --now autofs

to check:
sudo systemctl status autofs

sudo systemctl status autofs

autofs.service - Automounts filesystems on demand
*** Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; preset: disabled)***
*** Drop-In: /usr/lib/systemd/system/service.d***
*** └─10-timeout-abort.conf, 50-keep-warm.conf***
*** Active: active (running) since Thu 2025-02-06 12:53:41 CET; 51min ago***
*** Invocation: d032b69300834a12889c09d5f8ba72ab***
*** Main PID: 27169 (automount)***
*** Tasks: 5 (limit: 37998)***
*** Memory: 2.1M (peak: 4.3M)***
*** CPU: 60ms***
*** CGroup: /system.slice/autofs.service***
*** └─27169 /usr/sbin/automount --systemd-service --dont-check-daemon***

ls -l /var/mnt/nfs

my output:

totaal 0
drwxr-xr-x. 2 root root 0 6 feb 12:53 films
drwxr-xr-x. 2 root root 0 6 feb 12:53 series

This is how I mount my raspberry pi 5 nfs share under Bluefin.

After 60 seconds the directory will be empty. As soon you access it, it becomes active.

cheers!