Difference between revisions of "NFS"

From Christoph's Personal Wiki
Jump to: navigation, search
(Created page with "'''Network File System''' ('''NFS''') is a distributed file system protocol allowing a user on a client computer to access files over a computer network much like local storag...")
 
m (Christoph moved page Nfs to NFS)
 
(No difference)

Latest revision as of 00:32, 16 August 2016

Network File System (NFS) is a distributed file system protocol allowing a user on a client computer to access files over a computer network much like local storage is accessed.

Install and configure NFS

Note: The following is for the NFS master and client running on CentOS 6.

  • Assumptions:
    • Master IP: 192.168.200.204
    • Client IP: 192.168.200.203

Setup the master

  • Install the following NFS packages:
$ yum install nfs-utils nfs-utils-lib
  • Start services and make them persistent:
$ chkconfig nfs on 
$ service rpcbind start
$ service nfs start
  • Add the following line to /etc/exports:
/data	192.168.200.203(rw,sync,no_root_squash,no_subtree_check)
  • Export the /data path:
$ exportfs -a

Setup the client

  • Install the following NFS packages:
$ yum install nfs-utils nfs-utils-lib
  • Create the directory that will contain the NFS shared files:
$ mkdir -p /mnt/nfs/data
  • Mount the NFS share:
$ mount 192.168.200.204:/data /mnt/nfs/data
  • Check that it is mounted:
$ df -h
$ mount | grep nfs
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.200.204:/data on /mnt/nfs/data type nfs (rw,vers=4,addr=192.168.200.204,clientaddr=192.168.200.203)

Test the NFS mount

  • On the client:
$ echo "Hello, world" > /mnt/nfs/data/helloworld
  • On the master
$ cat /data/helloworld
Hello, world

It works.

  • Make the NFS mount persistent by adding the following line to the client's /etc/fstab:
192.168.200.204:/data   /mnt/nfs/data   nfs   auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800 0 0

External links