Updated March 31, 2023
Introduction to NFS
The Network File System is a client-server application that enables a computer operator to view, store & update files on the remote computer and was invented by Sun Microsystems in 1984 and is now managed by the Internet Engineering Task Force (IETF). The NFS protocol is the distributed file system standards use network-attached storage(NAS) which allows the computer operator to access a file over a network similar to we access over a local computer.
NAS is open-source and can be used to implement any protocol. It provides the features to mount all or some part of the file system over a network/server, which can be accessed by any user who has permission(Read-Only or Read-Write).
NFS uses Remote Procedure Call(RPC) to process the request between servers and clients.
NFS Working
To access data storage on a server or machine, the machine would use the process to access data available to the client. The Server Admin ensures the data security and availability to users as per permission assigned to them.
From the client, the machine requests data access by firing the “mount” command and on successful access, the client machine can see & interact with the file system.
NFS Versions
Here are the following versions mentioned below.
1. Version 2: It is released in March 1989. It is also known as RFC-1094 and works on the User Datagram Protocol(UDP) which is a stateless network connection. It has a storage of 32-bit with a max storage size of 4.2 GB and the data transfer rate is 8kb and needs to commit after the transfer is done.
NFS version 2 is now outdated and of no use as of now.
2. Version 3: Released in June 1995 with RFC-1813 as a standard name. It offers 32 -64-bit storage with more than an 8kb data transfer rate. It is based on the Transmission Control Protocol (TCP) with auto-commit.
This file system supports both UDP & TCP protocols.
3. Version 4: It is released in April 2003 also called by name RFC-3530.It carries strong authentication, caching, and better support internationally and is a state full file system. Based on the Transmission Control Protocol which ensures reliability and performance.
4. Version 4.1: Released in January 2010 with additional features of NFS on global Wide Area Network(WAN) on the based various encoding (UTF -8, ASCII) and also stated by RFC-5661.
5. Version 4.2: Released in November 2016, also known by RFC-7862 with features of distributed storage architecture & server-side copy with many other features
like Security-Enhanced Linux support.
Steps to Configure NFS on Linux
Here are the following steps mentioned below.
1. Installation: To install the NFS server type the below command on the Unix terminal :
Command: sudo apt install nfs-kernel-server
2. Configuration: We can set up the directories by adding them to /etc/exports in this
section:
Example :
/Linux *
/home *
How to start NFS: By executing the below command :
sudo systemctl start nfs-kernel-server.service
3. Client Configuration: We can share the NFS file or directory using the “Mount” command, which enables another machine to access the file system :
Example :
sudo mount File.hostname.com:/linux /local/linux.
** Please ensure that the file/directory must be present on the client and server machine.
4. Troubleshooting: In case of trouble in mounting NFS share make sure that the nfs-common package is installed on the client machine.
Command:
sudo apt install nfs-common
5. Unmounting file system: This command separates the mounted file system from the directory tree.
To separate a mounted NFS, we use the umount command followed by the directory path, where the file/directory has been mounted.
Command:
umount 192.10.20.10:/home/backup
umount /var/home/backup
** If the NFS mount present in the fstab file then normal umount command will fail.
So we need to find the process which is using the fstab file:
Command :
fuser -m Mounted_point
Once the process is finding the use kill -9 to abort the process then use the normal umount command.
** If facing any issue when there is a busy file system then fire the below command :
umount -l Mounted_point, where l option stands for lazy.
** If the NFS system is not approachable then, use the -f option to forcefully unmount the file system
umount -f Mount_point
NFS Usage Based on Linux & Window
Samba is another way to access the file system which is used in-parallel to NFS. However, each has some limitations.
Let us discuss each other briefly :
Samba is designed to communicate the Windows machine with another machine using other types of O/S. It means that it acts as a translator between the two machines.
Linux machine if needs to communicate with other Linux machines uses their native protocol using NFS that is much more efficient & reliable as compared to Samba.
Usage :
Server OS | Client OS | File System |
Window | Linux | NFS Samba |
Linux | Linux | NFS |
Linux | Window | Samba |
Window | Window | Samba |
Advantages
- A low-cost solution for file sharing.
- It is easy to set up and can use existing IP Infrastructure.
- It allows a user-friendly environment so that users can access the file from a remote host using the same procedure as they access files on the local.system.
- It removes the usage of removable media like Blu-Ray, DVD, CS, and USB drive, which enhances the security and storage of data over the network.
Disadvantages
- It works on RPCs that is inherently insecure in terms of security so a proper trusted network with a firewall enabled for secure communication between client and server machine and secure storage of the file.
- It is also vulnerable to internet malware like a virus, Trojan horse, DOS, DDOS attacks.
- NFS version 4.1 and NFS version 4 have bandwidth limitations and in terms of scalability which drop down in performance due to heavy network traffic
Recommended Articles
This is a guide to What is NFS. Here we discuss the Network File System(NFS) on Windows and Linux machine and their different version. You may also have a look at the following articles to learn more –