Skip to content


nfs is the Network File System.

Tips and Tricks

Wait for network to be online before mounting

If you are using /etc/fstab for your nfs mounts, you may run into a race condition where the network target comes online and allows NFS mounts to continue, but DHCP has not yet completed. This causes the NFS mounts to fail.

To fix this race condition, enable systemd-networkd-wait-online.service

sudo systemctl enable systemd-networkd-wait-online.service

Then edit your /etc/fstab entry to rely on that target.  /mnt/shared-media  nfs, ... the_rest_of_the_options

This solution so far works, but has the negative side effect of making boot take longer due to waiting for dhclient requests to time out before continuing. On Debian 12, this adds 2 minutes to the total boot time shown by systemd-analyze plot > boot-$(date +%F).svg.

If you know the exact interface your mount points rely on, then you can tailor the wait-online.service to only wait for that one interface:

sudo systemctl edit systemd-networkd-wait-online.service

Then add the following section to the correct location as directed by the comments in the editor window:

ExecStart=/lib/systemd/systemd-networkd-wait-online --ipv4 --interface=your_interface_name

The reason there is an empty ExecStart= is that this is how systemd is instructed to empty out the previous assignments instead of appending to them. This works with other option too. More info here:

Regarding mount points within shares

If you have a mount point within an NFS share, you must have a separate entry in your exports file that sets the permissions of this mount point. Currently OS X has a problem with this, but officially this is the way to do it.

Show hosts that are connected to this NFS server


Show what hosts are using what exports

showmount -a

Show exported directories

showmount -e

Show directories in use by NFS

showmount -d

Add an NFS mount to fstab

opal:/z4  /mnt/z4   nfs  rsize=8192,wsize=8192,timeo=14,intr

Linux Tips and Tricks

Show which versions of NFS your NFS server supports

rpcinfo -p

Allow an OS X client to mount nfs4 nested zfs data sets

OS X has problems with the privileged port default requirement in nfs4, so the insecure option is required.

The nohide option allows you to mount nested zfs datasets, instead of requiring a separate export for each dataset.

/z4 *.local(rw,async,no_subtree_check,insecure,nohide)

OS X Tips and Tricks

Create persistent NFS mount in OS X 10.8

This is not bulletproof. Modern OS X 10.9+ version are switching away from NFS to CIFS. The NFS client on OS X is pretty weak. For instance it might crash your machine if the share has 0 bytes free but is mounted RW. Use at your own risk.

sudo mkdir /mnt # OS X doesn't like you playing with /Volumes, it may delete your dirs
sudo dscl . -create /Mounts/z4
sudo dscl . -create /Mounts/z4 VFSLinkDir /mnt/z4
sudo dscl . -create /Mounts/z4 VFSOpts resvport rw nosuid
sudo dscl . -create /Mounts/z4 VFSType nfs
sudo dscl . -create /Mounts/z4 RecordName opal:/z4
sudo dscl . -create /Mounts/iTunes
sudo dscl . -create /Mounts/iTunes VFSLinkDir /mnt/z4/iTunes
sudo dscl . -create /Mounts/iTunes VFSOpts resvport rw nosuid
sudo dscl . -create /Mounts/iTunes VFSType nfs
sudo dscl . -create /Mounts/iTunes RecordName opal:/z4/iTunes
sudo dscl . -read /Mounts/opal:/z4
sudo dscl . -read /Mounts/opal:/z4/iTunes
sudo dscl . -list /Mounts

sudo dscl . -delete /Mounts opal:/z4/iTunes