Help with NFS file mount during boot

I just (mostly) finished the switch from Pop_OS to Endeavour and really liking it so far. My first time outside of the Ubuntu/Debian realm and using Arch. Having one issue though that is driving me nuts and I can’t figure out a solution and that’s with mounting NFS shares. I’m 99% sure the issue is related to the network connection not yet being ready when the services try to mount the share but I can’t figure out how to fix that.

I’ve been through the Arch Wiki (and this thread which is basically my issue but doesn’t seem to be a resolution in there) and here’s what I’ve done so far:

  • Started out with the “normal” fstab entry that I used with Ubuntu and served me well there. However, mount would not come up on boot and I had to do a sudo mount /mnt/Backup to get it to show up. Tried all the various options mentioned in the wiki regarding _netdev and noauto. Nothing worked.
  • Switched to a systemd mount service. It worked fine/no errors when started initially. However, same problem. Doesn’t mount on boot, only mounts if I go into the terminal and restart the service. I even tried adding noauto figuring that it was fine that the mount wasn’t available right on boot but still get an error. NFS-Backup.mount: Mount process exited, code=exited, status=32/n/a
  • Enabled NetworkManager-wait-online.service. No errors after boot, Says it started and finished during boot.
  • I tried a systemd.automount but that didn’t work either.

Here’s my mount service in case I missed something obvious:

[Unit]
Description=Mount NFS Backup

[Mount]
What=192.168.10.20:/volume1/Backup/
Where=/mnt/Backup
Options=noauto
Type=nfs
TimeoutSec=30

[Install]
WantedBy=multi-user.target

Any help would be appreciated!

1 Like

Would using autofs - which mounts on demand - meet your requirements?
That is what I use.
For example I just type cd /net/raspberrypi2/export/users and I’m there.
Note the ip address of raspberrypi2 is in my hosts file, substitute with ip address and it works fine as well.

$ df -h
Filesystem                  Size  Used Avail Use% Mounted on
dev                         7.8G     0  7.8G   0% /dev
run                         7.9G  1.7M  7.9G   1% /run
/dev/nvme0n1p3               99G   70G   24G  75% /
tmpfs                       7.9G  127M  7.7G   2% /dev/shm
tmpfs                       7.9G   20M  7.8G   1% /tmp
/dev/nvme0n1p1              511M  8.1M  503M   2% /boot/efi
/dev/nvme0n1p2              500G  269G  229G  55% /exthome
/dev/sda1                   932G  820G  109G  89% /media/Music
tmpfs                       1.6G   64K  1.6G   1% /run/user/2263
raspberrypi2:/export        6.9G  3.5G  3.1G  54% /net/raspberrypi2/export
raspberrypi2:/export/music  466G  437G   30G  94% /net/raspberrypi2/export/music
raspberrypi2:/export/users  6.9G  3.5G  3.1G  54% /net/raspberrypi2/export/users
raspberrypi2:/export/media  6.9G  3.5G  3.1G  54% /net/raspberrypi2/export/media

I’m not opposed to anything at this point. Trying to get autofs working and…it’s again kinda inconsistent.

I added this to /etc/autofs/auto.master: /mnt/nfs/Backup /etc/autofs/auto.backup --timeout=180

And this in /etc/autofs/auto.backup: Backup -fstype=nfs,rw,soft,intr 192.168.10.20:/volume1/Backup/

The folder gets created but…no data.

This will work in Arch too (and works for me). What line did you use in your fstab?

192.168.10.20:/volume1/Backup/ /mnt/synology_backup nfs defaults 0 0 is what i had. I tried the various noauto/systemd options without success.

Try:

192.168.10.20:/volume1/Backup /mnt/synology_backup nfs _netdev,noauto,nofail,x-systemd.automount 0 0

https://wiki.archlinux.org/title/Fstab#Automount_with_systemd

(This “works for me” on my local and SDN networks)

3 Likes

I’ll give a shot. Pretty sure I tried something virtually identical before. Managed to get autoFS working so at least there’s that (needed to do direct mounts).

1 Like

You’re a wizard. That worked! Thank you!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.