NFS is Unix and Linux type network based file system. This file system is served over network. In order to serve file system with files and directory nfsd
daemon is used. It is actually a kernel module with a service. NFS is the short form of Network Files System.
Installation
We can install NFS client tools and service with the following commands.
Ubuntu, Debian, Mint, Kali:
Following command will install client tools.
$ sudo apt install nfs-common
and with the following nfs-kernel-server
package we will install server daemon.
$ sudo apt install nfs-kernel-server

CentOS, Fedora, RHEL:
$ sudo yum install nfs-utils nfs-utils-lib
Versions NFSv2, NFSv3,NFSv4
NFS has different versions to use. Most recent version is v4. There are some major differences about versions. Most of the systems runs NFSv3
and NFSv4
Configuration File
NFS service has a default configuration which is stored as /usr/share/nfs-kernel-server/conffiles/nfs-kernel-server.default
. We can view an change it like below.
$ sudo vim /usr/share/nfs-kernel-server/conffiles/nfs-kernel-server.default

There is following configuration options to change.
RPCNFSDCOUNT
will set number of NFSD servers which will start.- `RPCNFSDPRIORITY` will set the process priority of the NFSD. Higher numbers will make our NFSD server more performative.
- `RPCMOUNTDOPTS` is used to set
rpc
mount options. - `NEED_SVCGSSD` is used for Kerberos authentication for exports. The default value is
no
which will disable Kerberos authentication. - During start of the NFSD we may want to provide some options the the
rpc.svcgssd
. We can set it with `RPCSVCGSSDOPTS` .
Share Files and Directories
Files sharing is the main purpose of the NFS service or NFSD . The file share is stored in the /etc/export
file like below.
$ cat /etc/exports

As we can see there are some example configurations which are not active. In this example we will share /mtn
directory to the all of the remote systems.
/mnt *
In this example we will share /mnt
to the only to the systems reside in 192.168.1.0/24
/mnt 192.168.1.0/24
We can also share the given path with a single remote system which is 192.168.1.10
in this example.
/mnt 192.168.1.10
Difference Between NFS and NFSD
NFSD
is a user level process but do not have any function to process NFS requests. NFSD redirects requests tot eh kernel transport endpoint and invokes a in-kernel process to process request and respond to the client. NFSD is the server side.
NFS
is the client side and each process accessing an NFS file system will make its own RPC request to the remote NFSD or NFS server.