Setting up NFS server
Edit the export file in /etc/exportsexports
/data 192.168.0.2(rw,no_root_squash,async)
Enable and start NFS service
chkconfig --level 35 portmap on chkconfig --level 35 nfs on service portmap start service nfs start
If portmap is not started, you will get an error similiar to the following:
Cannot register service: RPC: Unable to receive; errno = Connection refused rpc.rquotad: unable to register
Mounting the NFS share on remote machine
Create the mount point directory, then mount the NFS sharemkdir /nfs.data mount 192.168.0.1:/data /nfs.data
Make the mount permanent, edit /etc/fstab
192.168.0.1:/data /nfs.data nfs _netdev,soft,intr,rw,bg,rsize=32768,wsize=32768,nfsvers=3 0 0 # _netdev makes sure this mount is brought up after networking
Ubuntu as NFS client
Aside from the usual stuff, it seems that the following option is required otherwise NFS mount will be very slow and one will get repeated messages "lockd: cannot monitor x.x.x.x" in kernel buffer: /etc/default/nfs-common
NEED_STATD=yes
NFSv4
No idea why they make this so complicated and different form v3.Using CentOS as server
/etc/sysconfig/nfs
SECURE_NFS="no"
/etc/exports
/exports 192.168.18.0/24(rw,fsid=0,insecure,no_subtree_check,async)
/exports/home 192.168.18.0/24(rw,nohide,insecure,no_subtree_check,async)
/exports/home 192.168.18.0/24(rw,nohide,insecure,no_subtree_check,async)
/etc/idmapd.conf
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody
[Translation]
Method = nsswitch
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody
[Translation]
Method = nsswitch
Assuming you want to export /home, do this. This is because nfs4 works on psesdo filesystem?
mkdir /exports mount --bind /home /exports/home /etc/init.d/nfs start /etc/init.d/nfslock start /etc/init.d/rpcidmapd start
using ubuntu as NFS client
Notice that I'm mount /home on the remote server, not /exports/home!/etc/fstab
192.168.18.12:/home /home nfs vers=4,hard,bg,tcp,intr,rsize=8192,wsize=8192 0 0
/etc/idmapd.conf
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
/etc/defaults/nfs-common
NEED_IDMAPD=yes
mount remote share with vers=4 option
There are no comments on this page. [Add comment]