777funk
Posts: 6
Joined: Mon Sep 17, 2018 11:48 pm

FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Mon Sep 17, 2018 11:57 pm

Hereś what I have in my FSTAB file:

192.168.1.249:/home/n/Videos /mnt/nfs nfs defaults,user,exec 0 0

I can manually mount the share by:
sudo mount 192.168.1.249:/home/n/Videos/ /mnt/nfs

But I hate to do that every time I log into the pi

Is there something I have wrong in my FSTAB? It doesn´t seem to go.
Last edited by 777funk on Tue Sep 18, 2018 12:03 pm, edited 1 time in total.

777funk
Posts: 6
Joined: Mon Sep 17, 2018 11:48 pm

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 11:59 am

To update my own thread... if I run a:

Code: Select all

sudo mount -a
It loads up just fine. So something at boot is causing the issue.

It'd be nice to have this automatic as intended.

User avatar
scruss
Posts: 3482
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 12:24 pm

try adding

Code: Select all

nfsvers=3
to the options field.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

DirkS
Posts: 10445
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 12:25 pm

Looks like the network is not yet ready when fstab is processed.
You could try to activate 'wait for network' in raspi-config

Alternatively you could create a systemd mount file. That makes it easier to wait for the network to be up before mounting the share.
There are examples for the systemd file here on the forum.

DirkS
Posts: 10445
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 12:26 pm

scruss wrote:
Tue Sep 18, 2018 12:24 pm
try adding

Code: Select all

nfsvers=3
to the options field.
Would that make a difference? 'mount -a' works, so I would assume it uses the options that are in fstab.

User avatar
RaTTuS
Posts: 10597
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 1:01 pm

https://www.raspberrypi.org/forums/view ... 0#p1367168 what Dirks said...
as the network is not up use a systemd mounnter
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

777funk
Posts: 6
Joined: Mon Sep 17, 2018 11:48 pm

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 2:48 pm

I forgot to mention that I had also checked the "wait for network" box in raspi-config and that didn't do the trick. I was 99% sure it would have since the problem seems to be with timing during boot.

epoch1970
Posts: 5717
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 7:09 pm

Systemd reads fstab at boot and generates mount "units" that are all run in parallel. Which, not unexpectedly, causes issues.
You'll have to use systemd's x-systemd-automount option (and others) to mount that share.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
scruss
Posts: 3482
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Sep 18, 2018 8:59 pm

DirkS wrote:
Tue Sep 18, 2018 12:26 pm
Would that make a difference? 'mount -a' works, so I would assume it uses the options that are in fstab.
Makes all the difference on my installations.

It's probably redundant, but you can also add the _netdev option to signal the FS needs the network. NFS mounts automatically wait for the network, so you probably don't really need it.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

777funk
Posts: 6
Joined: Mon Sep 17, 2018 11:48 pm

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Wed Sep 19, 2018 7:25 pm

Solved it from within the fstab by adding the following into the fstab options settings:

Code: Select all

noauto,x-systemd.automount
So it looked like this when I was done...

Code: Select all

192.168.1.2:/home/n/Videos/ /mnt/nfs   nfs defaults,user,exec,noauto,x-systemd.automount       0 0
and it works.

thisisalloneword
Posts: 14
Joined: Mon Dec 24, 2018 2:13 am

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Tue Mar 17, 2020 6:08 pm

I am running into the exact same issue. I am trying to share a folder on a pi 3b+ with a pi 4. My /etc/fstab on the pi4 looks like:

# 192.168.1.51:/var/www/html/share /var/www/html/share nfs tcp,hard,intr,rsize=32768,wsize=32768 0 0
192.168.1.51:/var/www/html/share /var/www/html/share nfs defaults,user,exec,noauto,x-systemd.automount 0 0

If I uncomment out the first line and comment out the second line AND enable "wait for networking on boot", then it works. But is there any danger in enabling "Wait for network on boot"? What if there is no network?

ronnih
Posts: 32
Joined: Wed Nov 29, 2017 8:59 am
Location: Matrix Network
Contact: Website

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Thu Mar 19, 2020 8:48 am

Hi thisisalloneword,

I use the option "wait for networking on boot" since one year without problems. If no network available the system try first to mount the NFS share and after a short time out the system boot goes on.

My line for NFS share in the fstab:

Code: Select all

fileserver:/srv/nfs/USBDisk/NFSshare	/home/tux/NFSshare  nfs4  rw 0 0
https://techguru.lima-city.de

martyweb
Posts: 1
Joined: Wed Jul 15, 2020 1:06 pm

Re: FSTAB to automount NFS Share - No go... any ideas?? update: sudo mount -a WILL mount the FSTAB

Wed Jul 15, 2020 1:08 pm

DirkS wrote:
Tue Sep 18, 2018 12:26 pm
scruss wrote:
Tue Sep 18, 2018 12:24 pm
try adding

Code: Select all

nfsvers=3
to the options field.
Would that make a difference? 'mount -a' works, so I would assume it uses the options that are in fstab.
This worked great for me, thanks!

Return to “Raspberry Pi OS”