Ubuntu – How to mount an NFS drive via fstab

automountfstabmountnfs

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

What does work is mounting from CLI:

me@client:/$ sudo mount 192.168.178.4:/mountdir /mnt/mountdir
me@client:/$ 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?

Best Answer

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