Quick NFS Setup

quick-nfs-linux-setup Quick Guide Setting Up Network FileSystem

What is NFS? 

The Network File System (NFS) is a client/server application that lets a computer user view and optionally store and update files on a remote computer as though they were on the user's own computer. The NFS protocol is one of several distributed file system standards for network-attached storage (NAS). 

RedHat, Scientific Linux, CentOS, Fedora 

 Disable or allow firewall to NFS from clients connecting to NFS volume

You may also need the below set on your firewall depending on your zone. 

OR - disable firewalld 

Install NFS on (Client & Server)

Then enable and start the nfs server service so clients can connect. 

 Make the directory in which you want access too

Edit the exports file and add the following lines 

/home 192.168.1.101(rw,sync,no_root_squash,no_subtree_check)
/home/nfs 192.168.1.101(rw,sync,no_subtree_check)

 Now export changes from export to NFS and restart server

Restart NFS

Now you can mount the NFS volume

Skip below if you want to auto mount during startup ***** 

Mount | System IP/Host | Mount Point
---------------------------------
mount 192.168.1.100:/home /mnt/home
mount 192.168.1.100:/var/nfs /mnt/home/nfs

 OR


Say you have a hosts file with n1 as the host machine
127.0.0.1 localhost localhost.localdomain
192.168.0.10 n1

 You would then use below example to mount from server or host, although you need the hosts file on the clients as well like example.

mount n1:/home /mnt/home
mount n1:/var/nfs /mnt/home/nfs

Automounting NFS at OS Startup

Edit /etc/fstab

Add below line to fstab 

n1:/home/nfs /mnt/home/nfs nfs rsize=8192,wsize=8192,timeo=14,intr,rw,sync,hard,_netdev

Save it, then try mounting 

 Verify mount point by typing

If you modify the exports again you can use the below command options to export the new lines 

More details on command functions below 

exportfs -v : Displays a list of shares files and export options on a server
exportfs -a : Exports all directories listed in /etc/exports
exportfs -u : Unexport one or more directories
exportfs -r : Reexport all directories after modifying /etc/exports

 More information

nfsstat -m – Print information about each of the mounted NFS file systems. (install it with : apt-get install nfs-common)
nfsstat -c – A high number of NFS retransmissions can be detected
nfsstat -r – to see the current nfst statistics for retranmission of packets
netstat -s – Display summary statistics for each protocol.
netstat -i – To get the current value of your MTU
showmount – show mount information for an NFS server

Font size: +
Report Print
 

By accepting you will be accessing a service provided by a third-party external to https://www.klokur.com/