Linux OS service ‘nfs’

Service Name

nfs

Description

The Network File System (NFS) is a server/client based networking protocol. NFS daemons are composed by nfsd, rpc.mountd, rpc.rquotad, rpc.lockd.

1. nfsd: nfsd handles client requests from remote systems. Multiple copies of this daemon are usually run so that several requests can be handled simultaneously. However, too many copies of nfsd can increase the demand for CPU time to the point where a drop in performance results. For the best performance the number of copies of nfsd should be set to four.
2. rpc.mountd: rpc.mountd handles mount requests from remote systems.
3. rpc.rquotad: It is a rpc server which returns quotas for a user of a local file system which is NFS-mounted onto a remote machine.
4. rpc.lockd: rpc.lockd manages file locking on NFS client and server machines.

In order to run NFS service, the portmap daemon must run.

Service Management

To manage the NFS service for enabling or disabling the nfs service across reboots, use the chkconfig service:

#/etc/init.d/portmap status
portmap (pid 7428) is running...   [portmap service is started.]
# chkconfig nfs on
# chkconfig --list nfs
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off

To start/stop and check the status of nfs service use the service command.

# service nfs
Usage:Usage: nfs {start|stop|status|restart|reload|condrestart}

Start nfs service.

#service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

Stop nfs service.

# service nfs stop

Name of the package

nfs-utils
nfs-utils-lib

Configuration file

nfs uses the configuration file /etc/exports. The file contains the directories shared with other hosts and access parameters. For example :

# vi /etc/exports
/home/test 192.168.10.10(rw) *(ro,no_root_squash)

It makes the directory /home/test available to any user on 192.168.10.10 in read-write mode (rw) with squashing root privileges, but any other host (*) will have read-only(ro) access without squashing root privileges. Left-to-right scan, first match wins. root_squash means the person who starts the mounting process to this directory will not obtain the root privilege on this NFS server.

The syntax of /etc/exports is very sensitive to whitespace. A common error is to place a space between the host name pattern and the opening parenthesis. This quietly leads to incorrect behavior. Run the GUI configuration utility system-config-nfs to make the configuration easier.

Related Post