1

I have a NFS server running on CentOS 7.2 and I have a problem with one (path/client host) declared in my /etc/exports that should be exported and that is not...

My /etc/exports file :

/mnt/data/ host1(rw,all_squash,anonuid=1001,anongid=1001)
/mnt/data/ host2(rw,all_squash,anonuid=1001,anongid=1001)
/mnt/data/ host3(rw,all_squash,anonuid=1001,anongid=1001)
/mnt/data/ host3(rw,all_squash,anonuid=1001,anongid=1001)

I restarted my nfs server and do exportfs -a so the output of cat /var/lib/nfs/etab is correct:

/mnt/data   host1(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=1001,anongid=1001,sec=sys,rw,secure,root_squash,all_squash)
/mnt/data   host2(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=1001,anongid=1001,sec=sys,rw,secure,root_squash,all_squash)
/mnt/data   host3(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=1001,anongid=1001,sec=sys,rw,secure,root_squash,all_squash)
/mnt/data   host4(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=1001,anongid=1001,sec=sys,rw,secure,root_squash,all_squash)

But when I run showmount -e it does not show me host1 :

/mnt/data host2 host3 host4

And actually I could not mount /mnt/data from host1 :

[root@host1 ~]# mount -a
mount.nfs: access denied by server while mounting nfs-server:/mnt/data/

Whereas the mount is OK from host2,3 and 4.

PS :For information :

  • host1...hostn can see and ping the NFS server
  • SElinux has been deactivated for tests
  • No firewall neither on server nor on client (VM are clones one from each other)

Edit:

Thanks for your responses.

strace does not show much things:

stat("/run", {st_mode=S_IFDIR|0755, st_size=960, ...}) = 0
stat("/run/mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getcwd("/root", 4095)                   = 6
readlink("/root/nfs-server:", 0x7ffe3a9ee090, 4096) = -1 ENOENT (No such file or directory)
readlink("/mnt", 0x7ffe3a9edf70, 4096)  = -1 EINVAL (Invalid argument)
readlink("/mnt/data", 0x7ffe3a9edf70, 4096) = -1 EINVAL (Invalid argument)
stat("/sbin/mount.nfs", {st_mode=S_IFREG|S_ISUID|0755, st_size=113400, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fd1b08f6b50) = 51633
wait4(-1, mount.nfs: access denied by server while mounting nfs-server:/mnt/data/
[{WIFEXITED(s) && WEXITSTATUS(s) == 32}], 0, NULL) = 51633
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=51633, si_status=32, si_utime=0, si_stime=0} ---
close(1)                                = 0
close(2)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

What I see about running services on host1 side is that no nfsv4.0-svc service is running :

[root@host1 ~]# ps -aux --forest | grep nfs
root      1199  0.0  0.0      0     0 ?        S<   Feb15   0:00  \_ [nfsiod]

whereas it is running on other hosts that succeed in mounting /mnt/data

[root@host2 ~]$ ps -ef | grep nfs
root      1296     2  0 févr.15 ?     00:00:00 [nfsiod]
root      1302     2  0 févr.15 ?     00:00:00 [nfsv4.0-svc]

But I don't know if it is a cause or a consequence (i.e. nfsv4.0-svc is running because the mount succeed...) : could it be the source of the pb ?

  • Can you paste the output of strace on [root@host1 ~]# mount -a , such as strace mount -a – Ijaz Ahmad Khan Feb 16 '17 at 15:22
  • Can you please make sure all nfs related packages are installed on host1 and all the services are enabled and started – Ijaz Ahmad Khan Feb 16 '17 at 15:23
  • Disable Selinux on both server and host1 – Ijaz Ahmad Khan Feb 16 '17 at 15:24
  • Can you do a port scan from host1 to server? Can you see the NFS service ports from client , use nmap and telnet – Ijaz Ahmad Khan Feb 16 '17 at 15:26
  • NFS clinet versions are the same on all hosts?? – Ijaz Ahmad Khan Feb 16 '17 at 15:27
0

Sorry for the last post that was not a response... I'm quite new to stackexchange.

I finally found the problem: when running showmount -e or showmount -e [nfs-server DNS], the showed exports was not good.

But when running showmount -e localhost or showmount -e [nfs-server IP] its showed the correct exports (with host1 within).

So running my mount on host1 with the nfs-server IP solve the problem (too bad for our clone VM automation based on DNS...)

We are running or infrastructure on Azure so perhaps this DNS issue comes from it.

Thanks.

Alex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.