NFS Setup On Linux Based Systems

Andrew Rodriguez
Andrew Rodriguez
  • Updated

Scope:

This article provides a comprehensive guide on setting up Network File System (NFS) shares on a Linux kernel, enabling file sharing between systems on a network. It covers the installation and configuration of NFS server and client components, including practical examples to illustrate the process.

 

Install NFS Kernel Server:

# apt install nfs-kernel-server

 

Configuration file locations:

/etc/nfs.conf
/etc/nfs.conf.d/
/etc/exports


Setup files and directories for exporting:

Update /etc/exports file with directories to serve.

As an example:

# /srv/nfs4 192.168.108.0/24(rw,no_root_squash,async,insecure,crossmnt)

Re-export configuration:

# exportfs -rav

An explanation of the arguments for exportfs:

-r

Re-export all directories, synchronizing /var/lib/nfs/etab with /etc/exports. This option removes entries in /var/lib/nfs/etab which have been deleted from /etc/exports, and removes any entries from the kernel export table which are no longer valid.

-a

Export or unexport all directories.

-v

Be verbose. When exporting or unexporting, show what's going on. When displaying the current export list, also display the list of export options.

 

Validate files are exported:

Check the exportfs output:

# exportfs

Check the mountable directory:

# mount -t nfs HOST:DIR MOUNT_POINT

Troubleshooting tools

  • nfsstat
  • nfsiostat

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.