8

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
MountainX
  • 17,948
  • Can that client mount any of the other exported filesystems? Can it mount server:/ ? – Mark Plotnick Aug 26 '17 at 00:12
  • Yes, it 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 in my question. I'll update the question with some additional info. – MountainX Aug 26 '17 at 02:17
  • On the client, can you successfully mount server:/export/backup/system/pc1 using NFSv3? – Mark Plotnick Aug 27 '17 at 00:42
  • On the server, is /export/backup/system/pc1 a local filesystem? AFAIK, NFS doesn't yet support exporting a network filesystem. – Mark Plotnick Aug 27 '17 at 00:50
  • @MarkPlotnick - yes, /export/backup/system/pc1 is a local directory (same HDD as /). – MountainX Aug 27 '17 at 01:46

1 Answers1

0

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)
  • Sorry, this is incorrect. Because of the export /export 192.168.1.0/24(fsid=0,rw,sync,no_subtree_check) I do not include the /export portion of the path on the client. But thanks for looking at my question. – MountainX Aug 26 '17 at 02:24
  • 1
    @MountainX Err... You do need to include the /export bit too. By your logic, you would not need server:/backup/system/pc1, just server: since you have /export/backup/system/pc1 192.168.1.8(rw,sync,no_root_squash,no_subtree_check) on the server... – Kusalananda Aug 26 '17 at 06:53
  • 15
    Things are different with NFSv4. The client must request a path relative to a virtual root directory on the server. The exports entry with fsid=0 is the root directory. Confusing things even more is that showmount doesn't use NFSv4, so the paths it shows are correct only for NFSv[23] mounting. – Mark Plotnick Aug 26 '17 at 07:31
  • 3
    Just to clarify for future readers, Mark Plotnick is correct and this answer is wrong. – MountainX Aug 26 '17 at 18:31
  • And to add even more confusion, NFSv4 will work without a fsid=0 declaration, in which case the entire path is used. But in my exports where I do use fsid=0, I have the client fstab paths correct. – MountainX Aug 26 '17 at 18:34
  • I see. I did not know that. Thank you for the information. – Hunter.S.Thompson Aug 26 '17 at 18:35
  • @MountainX I have updated my answer with another possible solution. – Hunter.S.Thompson Aug 26 '17 at 18:50
  • @Hunter.S.Thompson - thanks again for your interest. The client IP address is correct. I updated the question with output of the appropriate command. – MountainX Aug 26 '17 at 22:30
  • 3
    @MarkPlotnick Could you perhaps write an answer to flesh that out a little bit? I'm getting this error. Trying to tell NFS to only use version 4 as well. – Nacht Sep 20 '20 at 11:34