NFS.SYSTEMD(7)
π NFS.SYSTEMD(7) π
okay bestie, pull up a chair, this is nfs.systemd from the Miscellaneous Information Manual (section 7, the good one) and it's literally all about managing NFS services through systemd. no cap.
β¨ NAME β¨
nfs.systemd β managing NFS services through systemd. π
πΈ SYNOPSIS πΈ
nfs-utils.service
nfs-server.service
nfs-client.target
etc
π¦ DESCRIPTION π¦
so the nfs-utils package ships a whole suite of systemd unit files and generators, and they're what let all the various services get started and managed. these unit files and generators are the reason everything kicks off in the correct order β they make sure the prerequisites are actually active before any dependant services start. π«Ά
but here's the thing: there are quite a few unit files and generators, so it's genuinely not immediately obvious how best to achieve certain results. the following subsections attempt to cover the issues that are most likely to come up. iykyk. π
βοΈ Configuration
standard systemd unit files do not give you any easy way to pass command line arguments to daemons so you can configure their behavior. in many cases you can still do that config by making changes to /etc/nfs.conf or other configuration files (see nfs.conf(5)). π
when that's not convenient, a distribution might hand you systemd "drop-in" files which replace the ExecStart= setting, so the program starts with different arguments. for example, a drop-in file systemd/system/nfs-mountd.service.d/local.conf containing:
[Service]
EnvironmentFile=/etc/sysconfig/nfs
ExecStart=
ExecStart= /usr/sbin/rpc.mountd $RPCMOUNTDOPTS
would cause the nfs-mountd.service unit to run the rpc.mountd program using, for arguments, the value given for RPCMOUNTDOPTS in /etc/sysconfig/nfs. this allows for seamless integration with existing configuration tools. slay. β¨
π Enabling unit files
there are three unit files which are designed to be manually enabled. all the others are automatically run as required. the three are:
nfs-client.targetβ this should be enabled on any host which ever serves as an NFS client. there is little cost in transparently enabling it whenever NFS client software is installed.nfs-server.serviceβ this must be enabled to provide NFS service to clients. it starts and configures the required daemons in the required order.nfs-blkmap.serviceβ theblkmapddaemon is only required on NFS clients which are using pNFS (parallel NFS), and particularly using the blocklayout layout protocol. if you might use this particular extension to NFS, thenfs-blkmap.serviceunit should be enabled.
several other units which might be considered to be optional, such as rpc-gssd.service, are careful to only start if the required configuration file exists. rpc-gssd.service will not start if the krb5.keytab file does not exist (typically in /etc). π
π Restarting NFS services
most NFS daemons can be restarted at any time. they will reload any state that they need, and continue servicing requests. this is rarely necessary though. π
when configuration changes are made, it can be hard to know exactly which services need to be restarted to ensure that the configuration takes effect. the simplest approach, which is often the best, is to restart everything. to help with this, the nfs-utils.service unit is provided. it declares appropriate dependencies with other unit files so that
systemctl restart nfs-utils
will restart all NFS daemons that are running. this will cause all configuration changes to take effect except for changes to mount options lists in /etc/fstab or /etc/nfsmount.conf. mount options can only be changed by unmounting and remounting filesystem. this can be a disruptive operation so it should only be done when the value justifies the cost. π the command
umount -a -t nfs; mount -a -t nfs
should unmount and remount all NFS filesystems.
π Masking unwanted services
rarely there may be a desire to prohibit some services from running even though they are normally part of a working NFS system. this may be needed to reduce system load to an absolute minimum, or to reduce attack surface by not running daemons that are not absolutely required.
three particular services which this can apply to are rpcbind, idmapd, and rpc-gssd. rpcbind is not part of the nfs-utils package, but it is used by several NFS services. however it is not needed when only NFSv4 is in use. if a site will never use NFSv3 (or NFSv2) and does not want rpcbind to be running, the correct approach is to run
systemctl mask rpcbind
this will disable rpcbind, and the various NFS services which depend on it (and are only needed for NFSv3) will refuse to start, without interfering with the operation of NFSv4 services. in particular, rpc.statd will not run when rpcbind is masked. π
idmapd is only needed for NFSv4, and even then is not needed when the client and server agree to use user-ids rather than user-names to identify the owners of files. if idmapd is not needed and not wanted, it can be masked with
systemctl mask idmapd
rpc-gssd is assumed to be needed if the krb5.keytab file is present. if a site needs this file present but does not want rpc-gssd running, it can be masked with
systemctl mask rpc-gssd
π§ Generators
systemd unit generators are small executables placed in /usr/lib/systemd/system-generators/ to dynamically extend the unit file hierarchy. the nfs-utils package provides three:
nfsroot-generatorβ it creates thesysroot.mountunit to mount/sysrootvia NFSv4 in the initrd, if it detects one the following options in the kernel command line:root=/dev/nfs nfsroot=[<server>:]<path>[,<options>]
defined in <kernel_source>/Documentation/admin-guide/nfs/nfsroot.rst
root=nfs[4]:[<server>:]<path>[:<options>]
defined in dracut.cmdline(7).
NOTE: although"nfs"can be used as type indicator for the mountpoint, the mount unit will use always"nfs4".
nfs-server-generatorβ it creates ordering dependencies betweennfs-server.serviceand various filesystem mounts: it should start before any"nfs"mountpoints are mounted, in case they are loop-back mounts, and after all exported filesystems are mounted, so there is no risk of exporting the underlying directory.rpc-pipefs-generatorβ it creates ordering dependencies between NFS services and therpc_pipefsmountpoint.
π FILES π
/etc/nfs.conf/etc/nfsmount.conf/etc/idmapd.conf
also similar files in /usr/etc and in related conf.d drop-in directories. π
π SEE ALSO π
bootup(7), systemd.generator(7), systemd.unit(5), nfs.conf(5), nfsmount.conf(5).
and that's the whole vibe, bestie β you just read NFS.SYSTEMD(7) from the Miscellaneous Information Manual, and it's giving certified unix baddie energy. go forth and systemctl responsibly. mwah. π
β¨π¦π
π¦ where this page comes from
- arch rolling: nfs-utils 3.1.1-1 Β· GPL-2.0-or-later
- fedora 43: nfs-utils 1:2.8.4-0.fc43 Β· LicenseRef-Callaway-MIT AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-BSD
- fedora 43: nfs-utils 1:2.8.7-6.fc43 Β· LicenseRef-Callaway-MIT AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-BSD
- fedora 43: nfs-utils-coreos 1:2.8.4-0.fc43 Β· LicenseRef-Callaway-MIT AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-BSD
- fedora 43: nfs-utils-coreos 1:2.8.7-6.fc43 Β· LicenseRef-Callaway-MIT AND GPL-2.0-only AND GPL-2.0-or-later AND LicenseRef-Callaway-BSD
- fedora 44: nfs-common-utils 1:2.8.7-0.fc44 Β· GPL-2.0-only AND GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND (HPND-export-US-modify AND HPND-sell-variant) AND (GPL-2.0-only WITH Linux-syscall-note OR BSD-3-Clause)
- fedora 44: nfs-common-utils 1:2.8.7-7.fc44 Β· GPL-2.0-only AND GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND (HPND-export-US-modify AND HPND-sell-variant) AND (GPL-2.0-only WITH Linux-syscall-note OR BSD-3-Clause)
- nixos 26.05: nfs-utils 2.9.1
- nixpkgs unstable: nfs-utils 3.1.1
- ubuntu resolute: nfs-common 1:2.8.5-1ubuntu1
- ubuntu stonking: nfs-common 1:2.9.1-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms