A Network File System (NFS) is a client/server internet protocol, created in 1984 by Sun Microsystems.
It is an indispensable file-sharing system that enables access to files on client computers via a network— anyone connected to the network can share and receive data seamlessly, which makes it a distributed file system.
In short, a network file system allows businesses to access and share crucial information with concerned personnel from anywhere, at any time, using any device connected to the client network.
The NFS protocol evolves continuously since it is an open-sourced solution where anyone can implement or modify protocols on all operating systems.
Which is why it’s easy to lose track of the inner workings of an NFS system. Keep reading to understand exactly how an NFS works, as we explore its different versions.
How does NFS work?
NFS is usually implemented in computing systems that have a common center for data and resource management. It works on all networks that are run by IP and uses UDP and TCP for delivering and accessing data.
To begin with, NFS employs a server/client computing model where authorization, authentication, and management of clients are governed by an NFS server. This system facilitates data in its entirety to be shared within a common file system.
The NFS prompts the server to link multiple clients using the "mount" command. The system design can implement security protocols to determine who can access files, thereby creating a secured and simplified work environment.
An NFS can also make use of a file-locking system to enable multiple users to access the same files at the same time. It can manage multiple applications and operations, making content handling a convenient and simplified affair.
An Overview of the Different Versions of NFS
How efficiently an NFS will perform depends on its version. Currently, there are three versions of NFS, each having a different standard of operation:
1. NFS Version 2 (NFS v2)
It is the oldest and the most compatible version that is in use and was developed in March 1989. It functions on UDP (User Datagram Protocol) via an IP network. This IP network ensures a stable, uninterrupted network connection.
The User Datagram Protocol does not have to establish a connection before initiating data transfer, making data sharing convenient and faster. UDP clients can continue sending requests to another server even when the server is not functional.
However, NFS version 2 is now effectively obsolete.
2. NFS Version 3 (NFS v3)
Developed in June 1995, NFS Version 3 (RFC-1813) backs asynchronous writes enabling the server to impose apt policies for synchronizing data. Data synchronization will be carried out before executing the command for data management. The design of NFS Version 3 offers better buffering as against version 2. Sun Microsystems provided this version with TCP as an additional transport option. TCP enables the version to operate over a wide area network with an additional capacity to read and write transfers.
Version 3 also has a COMMIT operation that makes asynchronous writes reliable and an ACCESS RPC to enhance the support for ACLs ( Access Control Lists) and power users. In this version, the server can instantly respond to WRITE RPCs without the need to sync with a disc or NVRAM.
NFS v3 handles huge files and errors more effectively. It can process 64-bit files enabling users to access about 2 GB file size on average.
3. NFS Version 4 (NFS v4)
NFS version 4 (RFC-3530) is the latest version of NFS with an updated protocol, developed in April 2003.
This version is a stateful file system with strong authentication, improved & advanced file caching, and efficient internalization capacity.
- It provides greater support for Microsoft Windows file sharing when compared to other versions.
- It does not need a rpc bind service which makes it easier to run in multiple places.
- The exports in version 4 can be bound together in a tree structure instead of mounting them separately.
- The TCP (Transmission Control Protocol) runs on NFS v4 operating between an IP and an application and monitoring data segments. When a data set needs to be resent, it requires only the missing data frames in the TCP set to be resent and not an entire data.
NFS version 4 server accepts commands of TCP port 2049. This port is one of the widely used popular ports in the market that eliminates the necessity to interact with rpcbind and lock servers.
Updated Versions of NFS v4
- NFS v 4.1
This is a minor version protocol that has features that enable NFS operations on global WANs. The updated version deploys parallel NFS to solve bandwidth and scaling issues. It uses UTF-8 for supporting internalization (like file names, directories, and other identifiers). NFS V4.1 also uses a new session model and directory delegation to maintain the server's connection with the client and share file operations to the client accessing them respectively
- NFS v 4.2
This latest minor version update was developed in November 2016. This has modern features to enhance the storage of scale-out architecture. This version includes SSC (Server-Side Copy), application I/O (Input/Output) suggestions, space reservations (to make sure all the files have a storage facility), sparse files (files having huge blocks of zero data that will be sent as zeros while reading from the file), ADB support (Application Data Block), and marked NFS that provides partial SELinux support.
Here's comparing the features and functionalities of the various NFS versions:
NFS Version 2
NFS Version 2
NFS Version 2
It is the oldest and most widely compatible, but it is not supported by RHEL 7.
NFS version 3 supports asynchronous writes and is more stable and reliable than NFS version 2, particularly in error handling.
NFS version 4 works well on the internet and can work through powerful firewalls. It does not require rcp bind service and supports ACLs. It makes use of stateful operations.
The size of the file data that can be handled by the clients is considerably small (32 bit)
It facilitates clients to access more than 2 GB of file data as this version can handle 64-bit files and offsets.
This supports massive file sizes and offsets.
Uses both TCP and UDP protocols. UDP runs over an IP network to ensure a hassle-free connection between the server and the client.
Uses both TCP and UDP protocols. UDP runs over an IP network to ensure a hassle-free connection between the server and the client
The protocol employs only TCP.
The UDP employed in NFS version 2 is stateless. If the server shuts down, the protocol will be flooded with requests for a server network.
The UDP employed in NFS version 3 is also stateless. If the server shuts down, the protocol will be flooded with requests for a server network.
TCP is stateful and offers an uninterrupted server network.
If the UDC loses a data frame, an entire RPC request must be resent.
If the UDC loses a data frame, an entire RPC request must be resent
If a data frame is lost by TPC, only the lost frame has to be resent. This is why TCP is the most preferred protocol for NFS servers.
The protocol is supported by RHEL6.
The protocol is supported by RHEL6.
The protocol is supported by RHEL6. RHEL6 chooses NFS version 4 as the default protocol.
Components Needed for NFS Versions
- Pseudo file system: It is a file system that differentiates physical and logical namespace. This is compatible with all three versions of NFS. The pseudo file system also comprises an alias provided by the exported file system.
- Compound RPC: The component combines all relevant operations and reduces unwanted interactions.
- Sessions and Session trunking: It allows single semantics and facilitates uninterrupted availability and efficient performance by engaging multiple networks between NFS Server and NFS 4.1 clients.
Services required to run NFS
There are several key services that make an NFS file system operational:
- nfs- The nfs service initiates the server and RPC processes to make the shared system compatible.
- nfs lock- This service begins the RPC processes and permits NFC clients to lock the files.
- portmap- This service helps in making port reservations from local services. portmap responds to notifications on the availability of ports for accessing files.
- rpc.mountd- This helps the users to grant access to the NFS files on a computer.
- rpc.nfsd- This service is used to define NFS versions and protocols for the servers.
- rpc.lockd- This command locks the files on a server.
- rpc.statd- This command will be initiated by the Network Status Monitor Protocol. This notifies a client when a server restarts. It also enables the server to stay online without shutting down.
Advantages of using Network file System
- Any number of clients can gain access to the same data from any remote network host.
- Computers can share applications eliminating the necessity of local disks thereby saving a lot of space.
- All users can access the same files and so the data remains updated, consistent, and reliable.
- File mounting system is common and transparent to every single user.
- NFS supports a heterogenous work environment by allowing the users to run hybrid technologies from different vendors and use components compatible with all technologies.
- Reduced overheads of system admin as a result of data centralization.
- Minimal use of removable drives and disks mitigating security concerns.
Disadvantages of Using Network File System
- Despite the version upgrades, NFS reviews suggest that the bandwidth and scalability of NFS is limited. Not to mention, it tends to slow down if network traffic is heavy.
- Since NFS runs on RPCs, it cannot be securely used unless the network server is firewall protected.
- Configuration of file settings in an NFS csn be complex and daunting.
- NFS is yet to provide support for non-sequential file access for the majority of clients.
- NFS comes with size limitations wherein a maximum of 1MB can be sent in every read or write request.
Applications of NFS
Below are a few practical ways to use NFS:
- Using Windows NFS file servers, multiple protocol access can be granted to share or receive the same file over SMB and NFS protocols from clients across various platforms.
- A window NFS server can be deployed in a non-windows operating system to grant access to a client for sharing NFS files on non-Windows computers.
- Applications can be transferred across different operating systems by storing the data on files that can be accessed via both SMB and NFS protocols.
We hope this guide gave you insight into the network file system. Drop us a line if you’d like to see us write about anything else!