My Wiki!

NFS

nfsServer: 2.0.0.1:/share/folder

nfsClient: 2.0.0.100

[root@nfsserver ~]# yum install nfs-utils nfs-utils-lib
[root@nfsserver ~]# yum install portmap (not required with NFSv4)

[root@nfsserver ~]# apt-get install nfs-utils nfs-utils-lib

[root@nfsserver ~]# /etc/init.d/portmap start
[root@nfsserver ~]# /etc/init.d/nfs start  
[root@nfsserver ~]# chkconfig --level 35 portmap on
[root@nfsserver ~]# chkconfig --level 35 nfs on
 
[root@nfsserver ~]# mkdir /share/folder
vi /etc/exports
/share/folder 2.0.0.100(rw,sync,no_root_squash)
$ exportfs -a
  • ro: With the help of this option we can provide read only access to the shared files i.e client will only be able to read.
  • rw: This option allows the client server to both read and write access within the shared directory.
  • sync: Sync confirms requests to the shared directory only once the changes have been committed.
  • nosubtreecheck: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger file system, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
  • norootsquash: This phrase allows root to connect to the designated directory.
  man exports
  
  
[root@nfsClient ~]# showmount -e 2.0.0.1
Export list for 192.168.201.1:
/mnt/nfv/odl/odl_dev_vm/nfs_data                       192.168.201.43
/home/dang/.vagrant.d/cache/debian-7.8-i386            192.168.121.219
/mnt/nfv/vagrant/vagrant_common_nfs/ubuntu32_ima_build 192.168.121.219
/home/dang/.vagrant.d/cache/trusty64                   192.168.121.153,192.168.121.79
/mnt/extdata/vagrant_nfs                               192.168.121.175,192.168.121.153,192.168.121.79    
  
  [root@nfsclient ~]# mount -t nfs 192.168.0.100:/nfsshare /mnt/nfsshare
  [root@nfsclient ~]# mount | grep nfs
  sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
  nfsd on /proc/fs/nfsd type nfsd (rw)
  192.168.0.100:/nfsshare on /mnt type nfs (rw,addr=192.168.0.100)
  [root@nfsclient ~]# vi /etc/fstab
  192.168.0.100:/nfsshare /mnt  nfs defauls 0 0

Navigation