Setting permanent NFS options

Hi there,

I'm trying to permanently set a couple options for nfsd / nfs-kernel-server. After a lot of searching, I ended up with the following in /etc/rc.local, which doesn't work:

echo 524288 > /proc/fs/nfsd/max_block_size
echo 4 > /proc/fs/nfsd/threads

When I reboot, neither of the settings are set when the device comes back up.

In the case of max_block_size this doesn't appear to work at all (write error: Resource busy when I try it by hand on the command line, and also doesn't work in rc.local)

In the case of threads it works fine when invoked manually, but does not work when placed in rc.local.

I looked everywhere for references to config files, or where to put such options in OpenWRT, but cannot find an answer. Anyone know?

Edit 1: I've found out I can effectively set threads by adding a given integer number of threads at the end of the line /usr/sbin/rpc.nfsd --grace-time 10 in /etc/init.d/nfsd although this feels more like a workaround than a solution.

Maybe the proper solution would be to make the init file read values from a file in /etc/config/ and use them as start options within the start_service function and then sending a PR for the OpenWrt packages repo.

2 Likes

It's possible, it may take me quite a while though as I only just built an OpenWRT image on my own system for the first time in the last couple weeks.