OpenBSD’s NFS client doesn’t need any daemons or configuration. Just mount
the remote filesystem. Here, I mount my home directory from my server treble
on /mnt:
# mount treble:/home/mwlucas /mnt
When mounting remote filesystems over NFS, enter the hostname or IP address, a colon, and the directory. Because I have the same UID on both the client and server, I can access, alter, remove, and add files in /mnt exactly as if I were dealing with files on a local filesystem.
Verify your mount with df(1)
or mount(8)
.
$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 1005M 266M 689M 28% /
…
treble:/home/mwlucas 26.9G 21.5M 25.5G 0% /mnt
The NFS-mounted directory shows up like any other mount point.
To mount an NFS share automatically at boot, or just record it for future convenience, you may use an /etc/fstab entry. If your system might not have DNS available to it at boot time, use an IP address for the NFS server. The following example specifies two fstab entries: one using a hostname and one using an IP address:
treble:/home/mwlucas /mnt nfs,noauto rw 0 0 192.0.2.88:/usr/ports /usr/ports nfs,noauto ro 0 0
Give all NFS partitions dump and fsck
numbers of 0
. Do not run fsck
or dump
on an NFS mount, as those programs require raw disk access that NFS doesn’t provide.
Use any other mount options you like. The OpenBSD folks recommend using noexec
, nodev
, and nosuid
“when applicable.” I recommend noauto
on NFS partitions that aren’t required for normal server operation, so that an unavailable NFS server does not hang your machine’s boot process.
NFS performance depends a great deal on your hardware, your local network, the clients and servers involved, the phase of the moon, and any number of other factors. If you’re not happy with your NFS performance, read mount_nfs(8)
and experiment with using TCP or UDP, the read and write sizes, and perhaps the timeout. If you need a complicated NFS environment, you should definitely invest some time in learning more about NFS.