Celeb Glow
updates | April 03, 2026

How can I persistently change nfs-kernel-server grace period settings?

I have a pacemaker with corosync nfs cluster (Ubuntu 18) and I'm trying to decrease the grace period.

Is there any way to make these settings persistent in /etc/default/nfs-kernel-server or pacemaker?

echo '10' > /proc/fs/nfsd/nfsv4leasetime
echo '10' > /proc/fs/nfsd/nfsv4gracetime
echo '10' > /proc/sys/fs/nfs/nlm_grace_period

Bron:

2 Answers

Thank you Killertjuh, I found your answer after asking Zanna's question myself when reading a LINBIT HA guide .

I recently had to deal with a similar situation with setting the --manage-gids option for my NFSv4 server, and found that these settings could be set in /etc/default, which eliminates the need to modify the script /usr/lib/systemd/scripts/nfs-utils_env.sh. That way you don't have as much risk of having the value overwritten by a future update of the script.

You can set the value in /etc/default/nfs-kernel-server:

RPCNFSDOPTS="--lease-time 10 --grace-time 10"

I tested and verified this on 18.04.

This might be transitional with a systemctl based methodology. Right now the script is run by the nfs-config systemctl service as a oneshot.

I tried overriding the environment variable in the nfs-kernel-server service but was unable to do it because of the way it is sourced in nfs-config. Perhaps a future release will change this.

find file "/usr/lib/systemd/scripts/nfs-utils_env.sh"

Change the line that starts with "echo RPCNFSDARGS" to:

echo RPCNFSDARGS=\"-L 10 -G 10 $RPCNFSDOPTS ${RPCNFSDCOUNT:-8}\"

for more info

# man rpc.nfsd -L or --lease-time seconds Set the lease-time used for NFSv4. This corresponds to how often clients need to confirm their state with the server. Valid range is from 10 to 3600 sec‐ onds. -G or --grace-time seconds Set the grace-time used for NFSv4 and NLM (for NFSv2 and NFSv3). New file open requests (NFSv4) and new file locks (NLM) will not be allowed until after this time has passed to allow clients to recover state.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy