Network File System or NFS is a network-based filesystem protocol which is mainly used to share files and folders over the network. NFS is a UNIX based technology but can be used by most of the operating systems like Linux, Ubuntu, Debian, Kali, Mint, Fedora, CentOS, RedHat and Windows operating systems Windows 7, Windows 8, Windows 10, Windows Server 2008, Windows Server 2012, Windows Server 2016.
Install NFS Server
NFS packages mainly divided into two parts. First is the server side packages which will install related kernel modules and server tools.
Ubuntu, Debian, Mint, Kali Client Packages
$ sudo apt-get install nfs-common
Fedora, CentOS, Fedora Client Packages
$ sudo yum install nfs-utils
Ubuntu, Debian, Mint, Kali Server Packages
$ sudo apt-get install nfs-kernel-server

After the installation is complete the nfs-server
service will be also created automatically.
Fedora, CentOS, Fedora Server Packages
$ sudo yum install nfs-utils
Check NFS Service Status
As the NFS shares will be served over nfs-server
we need to the if it is working. We will use systemctl status
command with the nfs-server
service name.
$ sudo systemctl status nfs-server

We can see that the service is active and working properly.
Start NFS Service
If the service is not started or stopped in any way we need to start the nfs-server
service. We will use systemctl start
command with the nfs-server
service name like below.
$ sudo systemctl start nfs-server
Create NFS Share
NFS main configuration is stored in the /etc/exports
file. Each share is created line by line. For example, if we want to share /mnt
with the IP address 192.168.10.10 we will use the following configuration.
/mnt 192.168.10.10
But generally, we share the files and folders with everyone who has access to the NFS server. We can use the following configuration to share everyone.
/mnt *
Enable Exports
After creating the share configuration we need to refresh the NFS table where the shares are stored. We can simply use exportfs
command with the -a
option which will add current configuration to the NFS table.
$ sudo exportfs -a
Mount NFS Share For Linux
We can use mount
command in order to mount NFS share. We will specify the filesystem type as nfs to the mount command with the -t
option like below. The server IP address is 192.168.142.144
and share is /mnt
. We will mount to the /home/ismail/poftut1
.
$ sudo mount -t nfs 192.168.142.144:/mnt /home/ismail/poftut1/
List NFS Mounts
After mounting the NFS share we can check it by listing the NFS mount. We will use mount
command and filter NFS shares with the grep
command like below.
$ mount | grep nfs

Unmount NFS Share For Linux
We can unmount already mounted NFS shares with the umount
command. We will just specify the mount path to the umount
command with the sudo
command like below.
$ sudo umount /home/ismail/poftut1
Mount NFS Share For Windows
First, we will enable NFS modules or features on Windows operating systems. Open Start > Control Panel > Programs. Select Turn Windows Features on or off. Select Services for NFS. Click OK.
We can mount NFS shares in Windows operating systems too. We will use mount
command. We will also provide nolock
option and other parameters like remote NFS server IP address and local drive which is Z
in this case.
> mount -o nolock 192.168.142.144:/mnt z:
Alternatively, we can use net use
command which can also mount NFS shares. We will provide the partition name which is z
and remote NFS server.
> net use z: \\192.168.142.144\mnt