Fstab entry for nfs

I'm trying to mount an NFS share from OpenWrt, and have successfully done so using a command similar to that in:-

but I can't get this working using fstab.

Can anyone help?

yeah,

life is sooo much easier when people having issues, don't post the config used ....

1 Like

Has openwrt installed the NFS server or does it behave like an NFS client?

server:
https://openwrt.org/docs/guide-user/services/nas/nfs_configuration

client:
https://openwrt.org/docs/guide-user/services/nas/nfs.client

I mentioned that I can mount the share from the command line, so I know NFS is working properly, I just can't get the fstab entry working.

Could you provide the command that works and allows the share to be mounted correctly... (thanks)

and your /etc/fstab

1 Like

The non-working entry in fstab is:-

192.168.1.11:/blob/    /mnt   nfs       rw,nolock       0       0   

The example in the link posted does work.

and the command that works?

I assume you have already tried the nfs version

The command that works is the one in the link, ie

mount -t nfs 192.168.1.3:/nfs /mnt/tmp -o nolock

if exactly this command works try:

192.168.1.3:/nfs /mnt/tmp nfs rw,nolock

or

192.168.1.3:/nfs /mnt/tmp nfs rw,nolock,nfsvers=3

otherwise you can show the last lines of the dmesg or logread command

I haven't found any logging of attempts to mount NFS shares so far.

One thing I have noticed is that 'mount -a' will mount the entry in fstab, so don't understand what's missing...

could be a race condition.

try adding a sleep 60; mount -a to your rc.local file.

2 Likes

That works even using 3 secs.

But it doesn't seem the correct way to achiever the solution. There must be some sort of builtin option, even though it escapes me. I tried '_netdev' but that didn't work. There's also 'timeout and 'retry' among others...

it looks like others have been trying to figure out a solution to this problem.

you could try to play around with the retry and timeo options described in https://linux.die.net/man/5/nfs

not sure they'll work in openwrt though.

I can't find any that work. Seems odd that the implementation of the nfs client on OpenWrt is different from other Linuxes....

Is there any means of logging nfs connections? mount -a works, but dmesg doesn't record anything.

mount is probably coming from busybox, try installing the mount-utils package, for proper mount.

I can't find any way to make it work.

AFAIAA an NFS entry on its own in OpenWrt does not work on bootup.

As far as I know there is no procedure or script in OpenWRT, which processes the /etc/fstab file at boot time. You have to do this on your own.

Your nfs entry in your /etc/fstab seems to be correct, because the command mount -a mounts the nfs share.

As @frollic suggested: put the command mount -a in your file /etc/rc.local. The latter file is processed during the OpenWRT boot process.

The command mount -a will mount all devices listed in /etc/fstab. If you just want to mount your nfs share, then put mount /mnt in your /etc/rc.local. That's all. Good luck!

1 Like