How can I mount an NFS drive via fstab

I am trying to auto-mount my NFS drives, but it doesn’t work too well sadly.

What does work is mounting from CLI:

[email protected]:/$ sudo mount 192.168.178.4:/mountdir /mnt/mountdir
[email protected]:/$ mount -t nfs
192.168.178.4:/mountdir on /mnt/mountdir type nfs (rw,addr=192.168.178.4)

when I try to add mountdir in the fstab, I cannot mount it due to “protocol not supported” (which seems strange as I can mount it)

$ sudo mount films_d3
mount.nfs: Protocol not supported

So there might be something wrong with my fstab entry.
This is my current entry:

192.168.178.4:/mountdir /mnt/mountdir  nfs auto,_netdev,noatime,nolock,bg,nfsvers=4,intr,tcp,actimeo=1800 0 0

During startup I also get this error twice: I was trying to fix the mount-from-fstab first, then worry about that, but nevertheless this might be a different problem:

init: idmapd-mounting (/mnt/kazemat/films_d3) main process (445) killed by TERM signal

This seems to be before the eth0 is initialised, while I thought the “_netdev” option would make the entry wait for the network to be up?

can anywone see the mistake in my fstab entry?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

with the help of @arjarj ‘s comment, I checked the difference between my fstab entry and the mtab entry after a cli-mount.

The clearest was, I thought, the missing nfsvers=4, and without that option it works perfectly. Strange as the mount.nfs4 bin is there, but maybe the other side does not support it.

Final entry in fstab looks like:

192.168.178.4:/mountdir /mnt/mountdir  nfs auto,_netdev,noatime,nolock,bg,intr,tcp,actimeo=1800 0 0

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply