How to Create an NFS Mount Point on CentOS 6.4
This is the instruction to create a mount point on CentOS 6.4
On a server
Check if nfs is installed
$ rpm -qa | grep nfs $ service nfs status`
Add a mount point
$ vi /etc/exports
In the above line,
format: <export> <host1>(<options>) <host2>(<options>)…
example:
/datafiles 192.168.2.38(ro)
/home/demo (rw)
/tmp (rw,sync)
/vol1 192.168.2.21(ro,sync)
The directories must be exported.
$ exportfs -a
To view exported file system
$ exportfs
Turn on nfs at start up
$ chkconfig nfs on $ chkconfig --list nfs $ service nfs start
Note: for each options available, read this link
On a client
Make a local folder
$ mkdir /myfolder
Issue this command
$ sudo mount -t nfs -v [ip or hostname]:/myfolder /myfolder
Troubleshooting
Most of the time, keep an eye on /var/log/message. This is a typical error when nfs rejects a client connect
rpc.mountd[30666]: refused mount request from x.x.x.x for /ster_storage (/ster_storage): illegal port 64877
it’s because it can’t resolve name of the client connected to it. NFS typically wants name resolution for clients connecting to it, and if it can’t get that, then it will deny access.
An entry in the hosts file is usually sufficient for me.
Check with firewall and SELinux
$ iptables -L $ getenforce
On Mac client, it connects to NFS using insecure port. Using the insecure option allows clients such as Mac OS X to connect on insecure ports. link
rpc.mountd[31257]: authenticated mount request from x.x.x.x:1017 for /foster_storage (/foster_storage) $ vi /etc/exports /datafiles 192.168.0.0/16(ro,insecure)