Page 1 of 2

Mounting remote share through nfs

Posted: 2020/05/16 09:55:28
by nitinkumar
I need a help in debugging the following problem.

1) I am trying to mount a share on my centOS 7 Virtual machine from Red hat enterprise server 6 ( an old one indeed !!!)

2) I am doing the following:-
Server IP address is 192.168.29.103
CentOS 7 VM client configured in bridge mode IP address is 192.168.29.72
Both machines are pinging.
NFS package is installed including nfs-utils on both RHEL 6 server as well as on CentOS 7 VM.
NFS is running on both the machine. "Service status nfs " command run on both the machines give output as "nfs activated (exited)" which
is highlighted in green color. this message is given along with other sentences indicating that nfs is properly enabled and running.

3) I am doing following things on RHEL 6 Server.
logging as root user.
# mkdir mountpoint
# chmod 755 mountpoint
# vi /etc/exports
/mountpoint 192.168.29.72(rw,sync) ------> mount directory "mountpoint" on client 192.168.29.72
save and exit.
NFS service restarted. system-config nfs restart <return>
check whether service restarted by checking "service status nfs". No error, green highlighted message "nfs activated (exited)" appears along with other sentences.

4) I am doing following things on CentOS7 client
logging as root user.
# mkdir /nitin
nfs is already running. Now i am trying to mount /mountpoint from server 192.168.29.103 on my directory /nitin
# mount -t nfs 192.168.29.103:/mountpoint /nitin < return>

HERE I AM GETTING ERROR "mount.nfs: no root to server".

In order to debug this problem I have disabled firewall on both the machines. Tried different ways but no success. /var/log/messages report no error.

Can anybody help me to find out what is the problem? What is the meaning of the message "nfs activated (exited)" ??

Re: Mounting remote share through nfs

Posted: 2020/05/16 13:37:31
by jlehtone
man exports wrote:fsid=num|root|uuid
NFS needs to be able to identify each filesystem that it exports. Normally it will use a UUID for the filesystem (if the filesystem has such a thing) or the device number of the device holding the filesystem (if the filesystem is stored on the device).
As not all filesystems are stored on devices, and not all filesystems have UUIDs, it is sometimes necessary to explicitly tell NFS how to identify a filesystem. This is done with the fsid= option.
For NFSv4, there is a distinguished filesystem which is the root of all exported filesystem. This is specified with fsid=root or fsid=0 both of which mean exactly the same thing.
Add that ot /etc/exports:

Code: Select all

/mountpoint 192.168.29.72(rw,sync,fsid=root)
and then

Code: Select all

# exportfs -rv
On client, I would try first:

Code: Select all

# mount -t nfs 192.168.29.103:/ /nitin
Furthemore, I would set autofs.service to mount for production.

Re: Mounting remote share through nfs

Posted: 2020/05/17 09:09:30
by nitinkumar
when I do the changes as told on the RHEL 6 Server, i get following error -----

exportfs: /etc/exports : 2 : bad fsid "fsid=root"

Re: Mounting remote share through nfs

Posted: 2020/05/17 09:22:37
by jlehtone
The man exports that I did quote was from online. Hence not from RHEL 6.
However, it did write: "specified with fsid=root or fsid=0".

Interestingly, man exports of CentOS 6 says the same, so "root" should be a valid value. Is your server up to date?

If root fails, then try the 0.

Re: Mounting remote share through nfs

Posted: 2020/05/17 09:45:32
by nitinkumar
yes. fsid=0 works. it gives output on server as "exporting 192.168.29.72:/mountpoint"

I think here is a mistake in /etc/exports file. 192.168.29.72 is client ip address and /mountpoint is server side share.

and still I get error "mount:nfs no root for server"

Re: Mounting remote share through nfs

Posted: 2020/05/17 11:03:51
by nitinkumar
Yes. "fsid=0" works and i get message on server as "exporting 192.168.29.72/mountpoint" where 192.168.29.72 is client ip address and /mountpoint
is a server side share.

but error "mount.nfs: no route to host" persists.

/etc/exports entry is ----> /mountpoint 192.168.29.72(rw,sync,fsid=0)

After getting error message i even tried server address 192.168.29.103 in /etc/exports file, restart nfs service, but the error "no root to host"
still exists.

Re: Mounting remote share through nfs

Posted: 2020/05/17 15:50:00
by jlehtone
nitinkumar wrote:
2020/05/17 11:03:51
"no route to host"
"no root to host"
Those are two very different strings. If it really is "no route to host", then problem is in network configuration.

Re: Mounting remote share through nfs

Posted: 2020/05/17 21:01:42
by TrevorH
If it's any use, no route to host is what you get when you hit the last iptables rule in the default set, that gives a -j REJECT.

Re: Mounting remote share through nfs

Posted: 2020/05/18 10:11:29
by nitinkumar
This looks to be a firewall issue because "mount.nfs: no route to host" message comes after about 180 -200 seconds after the mount command is given.

Now I want to know how to modify iptables to solve this issue ? I am using CentOS 7- Minimal.

Re: Mounting remote share through nfs

Posted: 2020/05/18 10:27:29
by MartinR
From my notes:

Network is unreachable

Don't believe this automatically, it may be due to the order in which IPv4 and IPv6 are tried. Diagnose as follows:

# mount -t nfs4 tamar.home:/inst /inst -v
mount.nfs4: timeout set for Mon Mar 6 18:37:07 2017
mount.nfs4: trying text-based options 'addr=192.168.63.213,clientaddr=192.168.63.172'
mount.nfs4: mount(2): Connection refused
mount.nfs4: trying text-based options 'addr=fdcf:48d:554d:3f::d5,clientaddr=::'
mount.nfs4: mount(2): Network is unreachable
mount.nfs4: Network is unreachable