rpc.mountd is the server daemon for the NFS mount.
When a remote NFS client is trying to access a file system on the NFS server where mountd is running, this daemon will check the access control in the export table to determine whether to give access to the remote NFS client or not.
rpc.mountd is part of nfs-utils package. You should install it if you don’t have it, using yum install nfs-utils.
The options to mountd can be passed from the command line, or you can use /etc/sysconfig/nfs file which will be used by the /etc/rc.d/init.d/nfs program during startup.
For every successful mount, rpc.mountd adds an entry to the /var/lib/nfs/rmtab file. When it receives the unmount request, it will remove the corresponding enbtry from this rmtab file.
The following is an example of this rmtab file.
# cat /var/lib/nfs/rmtab 192.168.1.52:/home/data/files:0x00000002 192.168.1.36:/home/data/db:0x00000004 192.168.1.26:/u01/oracle/admin:0x00000002
1. Change State Directory Path
By default, mountd places all the state information in the /var/lib/nfs directory. If you want to change this to a different location, use -s option as shown below.
# rpc.mountd -s /var/lib/mountd # rpc.mountd --state-directory-path /var/lib/mountd
As you see below, the following are some of the information that are stored in this directory this rpc.mountd program.
# ls -l /var/lib/nfs total 32 -rw-r--r-- 1 root root 366 Aug 22 2011 etab -rw-r--r-- 1 root root 454 May 6 09:47 rmtab drwxr-xr-x 7 root root 0 Feb 23 2011 rpc_pipefs drwx------ 4 rpcuser rpcuser 4096 May 18 2010 statd -rw------- 1 root root 0 Jan 21 2009 state drwxr-xr-x 2 root root 4096 Jan 21 2009 v4recovery -rw-r--r-- 1 root root 0 Jan 21 2009 xtab
2. Use hostname of Clients in RMTAB
If you use -r (stands for reverse lookup) option during startup, this will do a reverse lookup on the ipaddress and display the hostname instead of the ip-address that is shown above in the rmtab output.
Please note that enabling this option is not preferred in certain situations, at it will be slow to do reverse lookup of ip-address to get their hostnames. So, be careful if you decide to enable this option.
# rpc.mountd -r # rpc.mountd --reverse-lookup
3. Increase Number of Threads
Option -t will increase the number of threads. By default, it starts 1 thread. But, if you are running a high volume NFS server which gets several hundred NFS mount request every second, you can increase the threads.
The following example, increases the mountd threads to 5.
# rpc.mountd -t 5 # rpc.mountd --num-threads=5
4. Enable Debugging Levels
mountd program offers these debugging types: all, auth, call, general, parse
You can specify one of this using -d option as shown below. This is helpful when you want to debug some issues with the NFS.
# rpc.mountd -d all # rpc.mountd --debug all
5. Restrict NFS Version
By default, mountd supports NFS version 2, 3 and 4. If you want to restrict some of the NFS version, you can use the -N option.
The following example restricts NFS version 4.
# rpc.mountd -N 4 # rpc.mountd --no-nfs-version 4