Why and when to use nfs_client_enable?

In the FreeBSD manual (and on different articles on the internet) it's stated that: to be able to mount NFS mounts you must add the following lines to /etc/rc.conf

Code:
nfs_client_enable="YES"
nfs_client_flags="-n 4"

I'm running a box with FreeBSD 9.2 that needs to mount shares from a Solaris box. Right now, I have set up my mounts in /etc/fstab like this:

Code:
nfs-server:/export/files /files nfs ro,hard,bg 0 0
nfs-server:/export/files2 /files2 nfs rw,hard,bg 0 0

However, I have not enabled the NFS client in /etc/rc.conf, and it still works as excepted, i.e. my NFS are mounted automatically during boot.

So my question is: when and why do I have to explicitly enable the NFS client in /etc/rc.conf. What is the difference when enabling it and not enabling it? Is it maybe enabled by default on later FreeBSD versions?

Thanks
 
It's not enabled by default, it's enabled because of the NFS entries in your /etc/fstab. It's simply automatically loaded when needed. You can still enable it explicitly of course. Doing so would allow you to change some of the NFS parameters if you need to.
 
Actually it goes even deeper than that.

First thing to realize is that support for things such as (network) protocols comes from the kernel, that's obvious. But also that such support can either be embedded in the kernel itself or added (and sometimes even removed again) through the use of kernel modules (see the /boot/kernel/*.ko files). Some of those modules can be loaded automatically the moment the kernel detects that they're needed. Including the modules which provide support for NFS.

Another thing to keep in mind is that not all rc.d scripts represent daemons or services. And nfsclient is just such an example. It's main function is to make it easier on your end to control / customize the NFS client sysctl settings by allowing you to specify these right from within rc.conf. For example nfs_access_cache sets vfs.nfs.access_cache_timeout and nfs_bufpackets sets vfs.nfs.bufpackets.

In fact; this rc.d script doesn't even bother to try to load the kernel modules which you'll need for NFS support.

So in the end you don't need this setting at all, which holds especially true if you don't have any specific customization requirements. And even if you do then you could also opt to set those sysctl settings directly in /etc/sysctl.conf.
 
Back
Top