Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make a persistent change to sunrpc.tcp_slot_table_entries on a Linux CentOS 5.5. This value has been found important for the performance of our NFS clients, and must be set before the NFS mounts are done.

Simply putting the value in /etc/sysctl.conf doesn't work because /etc/rc.d/rc.sysinit (which does the sysctl -p) is executed before the sunrpc module is loaded.

Same problem with RHEL 4:

I tried to:

  • put install sunrpc /sbin/modprobe -q --ignore-install sunrpc;/sbin/sysctl -w sunrpc.tcp_slot_table_entries=64 in /etc/modprobe.conf (and in /etc/modprobe.d/sunrpc)
  • put SUBSYSTEM=="module" ACTION=="add" DEVPATH=="*/sunrpc" RUN+="/sbin/sysctl -w sunrpc.tcp_slot_table_entries=64" (maybe it has to be changed for CentOS 5) in /etc/udev/rules.d/23-sunrpc.rules but to no avail.

And I'd prefer not to modify /etc/init.d/netfs (from initscripts package).

So, have you succeeded in doing it properly on a CentOS 5, and if so, how ?

Edit: found in /etc/modprobe.d/modprobe.conf.dist:

install sunrpc /sbin/modprobe --first-time --ignore-install sunrpc && { /bin/mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs > /dev/null 2>&1 || :; }

That's maybe why my own addition to modprobe wasn't taken into account. But I'm not sure if I should modify directly that file, as it may be overwritten by module-init-tools updates ...

share|improve this question
up vote 1 down vote accepted

Finally I created an almost dummy init script, inserted at S15 (see in /etc/rc3.d/), as the module is loaded in S14 (nfslock) and used in S25 (netfs).


# sunrpc_tuning       Tunes /proc/sys/sunrpc (launched after lockd)
# chkconfig: 345 15 85
# description: set values to sunrpc after module is loaded
# probe: true

case "$1" in
      echo "Setting sunrpc.tcp_slot_table_entries ..."
      /sbin/sysctl -w sunrpc.tcp_slot_table_entries=128
   *) ;;

Then: chkconfig --add sunrpc_tuning

share|improve this answer

I'm running RHEL5.4, and it seems that somehow the sysctl.conf settings are being applied (somehow?) before netfs mounts volumes. How did you verify this?

I modified the netfs initscript, to write the sunrpc.tcp_slot_table_entries value before nfs mounts were actioned, and it wrote out '128' vs the default '16'.

    # Let udev handle any backlog before trying to mount file systems
    /sbin/udevsettle --timeout=30
    [ -n "$NFSFSTAB" ] &&
        [ ! -f /var/lock/subsys/portmap ] && service portmap start
 /sbin/sysctl sunrpc.tcp_slot_table_entries >> /tmp/sunrpc
        action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4
share|improve this answer
actually, sysctl is called in /etc/rc.d/rc.sysinit, which is executed before any runlevel initscripts get run, so I'm not sure why you have to do what you're doing here... – jau Nov 2 '11 at 14:05
actually, sysctl is called in /etc/rc.d/rc.sysinit, which is executed before any runlevel initscripts get run, so I'm not sure why you have to do what you're doing here... The reason is that at sysinit time the sunrpc module isn't loaded so there's no /proc/sys/sunrpc to modify. It has to be done between sunrpc loading (network init) and nfs mounting. – David142 Nov 14 '12 at 13:42

You could put /sbin/sysctl -w sunrpc.tcp_slot_table_entries=64 in /etc/rc.d/rc.local.

share|improve this answer
# This script will be executed *after* all the other init scripts. so it's not useful as sysctl will be done after the NFS mounts, and the setting won't be taken into account. – David142 Sep 28 '10 at 7:08

I had tried something similar to what David142 tried, and this was on a RedHat 6.3 system, but I was finding that even at S15 or S20, it was still not being set out since the sunrpc kernel module was not loaded. Even when S52netfs starts and tries doing sysctl -p, it would fail.

The fix I tried was similar to yours, but I added a modprobe command:

# set_nfs_parms        Set kernel parmeters for NFS
# chkconfig: 235 15 85
# description: At boot time, sunrpc.tcp_slot_table_entries cannot be set since
#              the nfs module is not loaded.  This sets it later in the boot
#              sequence. 

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
          #/sbin/sysctl -w sunrpc.tcp_slot_table_entries=128
          /sbin/modprobe sunrpc
          /sbin/sysctl -p
       echo $"Usage: $0 {start}"
       exit 2
exit $?

After that, the parameter seems to reliably get set after a reboot.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.