Nfs mount failed: reason given by server: No such file or directory

nfs

The nfs server is running Arch Linux. The nfs client below ("pc1") is running Ubuntu 16.04. Both are using nfs4.

root@PC1:~# cat /etc/fstab (relevant line shown below):

server:/backup/system/pc1 /backup/system nfs4 auto,noatime        0 0

After the client boots, the nfs mount fails: journalctl -b -p err (output shown below):

Aug 25 17:56:43 LatishaPC1 systemd[1]: Failed to mount /backup/system.

root@PC1:~# showmount -e server (output shown below):

Export list for server:
/export                          192.168.1.0/24
/export/backup/system            192.168.1.0/24
/export/backup/system/pc1 192.168.1.8

manually trying to mount (as root) using mount /backup/system gives this output:

mount.nfs4: mounting server:/backup/system/pc1 failed, reason given by server: No such file or directory

However, we see from showmount that the server does list the directory.

Here's the /etc/exports file on the server:

/export 192.168.1.0/24(fsid=0,rw,sync,no_subtree_check)                                                            
/export/backup/system/ 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check,nohide)
/export/backup/system/pc1 192.168.1.8(rw,sync,no_root_squash,no_subtree_check)

I tried it without and without that last line above. Same error either way.
I've been troubleshooting for several days and have not resolved it. (I have other nfs servers and clients that are working as expected and I have compared this config to the working systems and I don't see a difference.) I checked many similar questions. I'm probably overlooking an obvious answer. I apologize in advance if this has already been answered somewhere on StackExchange. I didn't find a solution yet.

UPDATE 1:

The client can mount server:/ and mounting that gives another clue. When navigating the mount to /backup/system/, the directory is empty. It should contain "pc1" as shown in the showmount command above.

Here are the file permissions as shown on the server.

[root@server export]# cd backup/
[root@server backup]# ls -la
drwxr-xr-x 1 root         root   76 Jun  3 02:31 .
drwxr-xr-x 1 root         root   12 Aug 25 02:44 ..
drwxr-xr-x 1 root         root  142 Jul  5 19:58 system
[root@server backup]# cd system/
[root@server system]# ls -la
drwxr-xr-x 1 root root 142 Jul  5 19:58 .
drwxrwx--- 1 root root   6 May 28 11:35 pc1

UPDATE 2:
output of root@PC1:~# ip a follows. It shows that the IP address listed in /etc/exports on the server is correct.

2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 192.168.1.8/24 brd 192.168.1.255 scope global dynamic enp0s31f6

Best Answer

Does not apply to NFSv4:

Why did you not include the folder before /backup/?

It should be :

server:/export/backup/system/pc1 /backup/system nfs4 auto,noatime        0 0

You need to mount it according to your export file.

Edit :

Could it be that you are exporting the file pc1 only to the IP address 192.168.1.8 and your client does not have that IP.

Try changing the IP address :

/export/backup/system/pc1 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
Related Question