NFS Option Reload without Service Restart

5,674

Solution 1

And after an obvious mental lapse, I remembered the /proc filesystem. /proc/fs/nfsd, specifically, controls the runtime settings of the nfsd service.

In my case, this meant echo '32' > /proc/fs/nfsd/threads sets the number of threads to 32.

Solution 2

You can execute rpc.nfsd from the command line and specify the number of processes to add or remove if the nfs server is already running.

From man 8 rpc.nfsd

/usr/sbin/rpc.nfsd [options] nproc

Note that if the NFS server is already running, then the options for
specifying host, port, and protocol will be ignored.  The number of 
processes given will be  the  only option  considered,  and  the  number
of  active nfsd processes will be increased or decreased to match this 
number. In particular rpc.nfsd 0 will stop all  threads  and thus close 
any open connections.
Share:
5,674

Related videos on Youtube

Karan Rekhi
Author by

Karan Rekhi

20 years of Linux System Administration and Infrastructure Tooling Development in both the cloud provider and AWS-consumer spheres, with a focus on healthy process and tooling to build efficient, effective, and happy development organizations.

Updated on September 18, 2022

Comments

  • Karan Rekhi
    Karan Rekhi almost 2 years

    What do I need to do to change the RPCNFSDCOUNT setting without a full service restart?

    I need to reload the NFS configuration without restarting the service. The RPCNFSDCOUNT thread count is too low for the workload but I cannot get the management to agree on a schedule for a change window.

    A normal service can frequently do this with a SIGHUP. I did attempt this with a kill -HUP $(pidof rpc.mountd), but that was unsuccessful in getting the new RPCNFSDCOUNT setting applied from /etc/sysconfig/nfs on this old Fedora 8 box.

    The man pages for the other NFS daemons incline me to think that HUP'ing those processes won't be of any benefit, and I'm rather reluctant to HUP the kthreadd process that is the parent process of the nfsd threads themselves.

  • Karan Rekhi
    Karan Rekhi about 12 years
    Actually, at least with Fedora 8, 'service nfs reload' ONLY runs exportfs -r per the /etc/init.d/nfs script.
  • George M
    George M about 12 years
    @Adrian You are right. See my edit.