NFS (Network File System) relies on several key daemons (background processes) to manage file sharing between the NFS server and clients. These daemons are responsible for handling various aspects of the NFS protocol, such as client-server communication, mounting file systems, and locking files.
Key NFS Daemons
1. nfsd
(NFS Daemon)
- Purpose: This is the core NFS server daemon responsible for handling requests from NFS clients. It facilitates the actual sharing of file systems over the network and processes incoming requests like reading, writing, and mounting NFS shares.
- Functionality:
- It responds to file access requests from NFS clients.
- Handles read, write, and other file operations remotely for the NFS clients.
- Location:
/usr/sbin/rpc.nfsd
- Configuration: The number of NFS threads (worker processes) can be configured, which determines how many simultaneous requests can be handled.
sudo service nfs start # Starts the nfsd service
2. rpcbind
(Portmapper)
- Purpose: It maps RPC (Remote Procedure Call) services like NFS to their corresponding port numbers. NFS is an RPC-based protocol, and
rpcbind
is required to provide the correct port numbers to clients for communication with NFS services. - Functionality:
- Clients contact
rpcbind
to discover which port NFS daemons (such asnfsd
andmountd
) are using. - Helps with client-server connection establishment by directing NFS requests to the correct daemon.
- Clients contact
- Location:
/sbin/rpcbind
- Command:
sudo systemctl start rpcbind # Starts the rpcbind service
3. rpc.mountd
(Mount Daemon)
- Purpose: The
mountd
daemon is responsible for processing the mount requests from NFS clients. It checks the/etc/exports
file to determine which file systems are available for sharing and verifies client permissions. - Functionality:
- Manages client requests to mount NFS shares.
- Ensures that clients have proper permissions to mount the file systems.
- Location:
/usr/sbin/rpc.mountd
- Configuration: It reads the
/etc/exports
file on the NFS server and verifies the access control settings.sudo systemctl start nfs-server # Starts the mountd service along with nfsd
4. rpc.statd
(Status Monitor)
- Purpose: This daemon handles NFS file-locking and monitors the status of NFS clients. It helps in recovering file locks in case the server or client crashes.
- Functionality:
- Tracks NFS client-server relationships for file locking.
- Helps in crash recovery and file lock management by keeping track of lock states.
- Location:
/usr/sbin/rpc.statd
- Command:
sudo systemctl start rpc-statd # Starts the rpc.statd daemon
5. rpc.lockd
(NFS Locking Daemon)
- Purpose: This daemon manages file locking over NFS. When a client tries to lock a file on the NFS server, the
lockd
daemon handles the lock requests. - Functionality:
- Coordinates NFS file locking and unlocking requests between the client and server.
- Ensures that multiple clients do not modify the same file simultaneously, preventing file corruption.
- Location:
/usr/sbin/rpc.lockd
- Command:
sudo systemctl start rpcbind # Starts the rpc.lockd service along with rpcbind
6. rpc.rquotad
(Quota Daemon)
- Purpose: The
rquotad
daemon allows NFS clients to obtain quota information from the server. It reports on user and group quotas for file systems shared via NFS. - Functionality:
- Reports on disk usage limits for users and groups on NFS file systems.
- Sends quota information to NFS clients requesting it.
- Location:
/usr/sbin/rpc.rquotad
- Command:
sudo systemctl start rpc-rquotad # Starts the rpc.rquotad daemon
Summary of NFS Daemons
Daemon | Purpose | Location | Functionality |
---|---|---|---|
nfsd | Main NFS server daemon | /usr/sbin/rpc.nfsd | Handles file access requests from NFS clients. |
rpcbind | Port mapper for RPC services | /sbin/rpcbind | Maps RPC services to ports, helping clients find the NFS service. |
rpc.mountd | Manages NFS mount requests | /usr/sbin/rpc.mountd | Processes mount requests and verifies client permissions. |
rpc.statd | Monitors client-server relationships | /usr/sbin/rpc.statd | Handles NFS file-locking and crash recovery. |
rpc.lockd | Manages file locking across NFS clients | /usr/sbin/rpc.lockd | Ensures proper file locking and unlocking across NFS clients. |
rpc.rquotad | Manages quotas for NFS file systems | /usr/sbin/rpc.rquotad | Provides quota information to NFS clients. |
NFS Daemon Configuration Files
/etc/exports
: This file lists the directories that are shared via NFS and the client access permissions.- Example:
/var/nfs_share 192.168.1.0/24(rw,sync,no_subtree_check)
- Example:
/etc/sysconfig/nfs
: This file is used to configure various NFS-related settings such as port numbers and whether to enable or disable certain NFS daemons.