NFS in Plan 9 mkf ABSTRACT Using NFS server in Plan 9 Background Historically, there have been two ways to access remote file systems in UNIX. Sun's NFS and AT&T's RFS, ultimately NFS took over as de facto remote file system for UNIX. NFS had multiple versions, NFSv2 was first version that got released into public (and Plan 9 has a server for, but not a client), NFSv3 addresses some issues with old model and improves it in ways (and Plan 9 has a client for, but not a server). NFSv4 and later do some radical changes and makes it (more) suitable for a modern networked file system, however it is currently just supported by FreeBSD and Linux at the time of writing this guide. Server Plan 9 ships with a NFSv2 server, which is old, but works. it's code is located in /sys/src/cmd/9nfs/nfsserver.c:63. In order to use it, there is a helper script in /rc/bin/service/startnfs. Unlike rest of scripts in /rc/bin/service/ this one needs to be executed manually (perhaps in cpurc). You may want to remove 9fs lines and tweak aux/nfsserver arguments to add file servers you need to serve over nfs, for example, to serve /srv/boot change startnfs like: aux/nfsserver -f /srv/boot -c /lib/ndb/nfs >>[2] /sys/log/nfsserver to serve other directories, you can use srvfs(8) in your cpurc. Afterwards, you need to change /lib/ndb/nfs, Here is a example: #server client uidfile gidfile !9fs files .+ .+ /n/files/passwd /n/files/group November 23, 2024 - 2 - Server and clients are in forms of regular expressions of domain names. Note that .+ means all possible strings, and thus allows every computer to connect to your file system, this isn't usually what you want. You can limit clients that access your system by setting a more strict name instead of .+. For example, for a setup that only allows unix.cloud9p.org: .+ unix.cloud9p.org /dev/null /dev/null Names are checked via their reverse DNS name, so you likely need to ensure it works (clients can't connect otherwise). uidfile and gidfile are used to map users and groups of Plan 9 machine to UNIX uids and gids, they are NOT used for auth. Both may be /dev/null. Finally, to connect you may use the following command (in OpenBSD): $ doas mount_nfs -2 server:spec /mnt where spec is the name of file server you are sharing (via -f or -a ). for example, $ doas mount_nfs -2 wm:boot /mnt to mount /srv/boot in /mnt. note that -2 is required, we (only) speak NFSv2 currently. see nfsserver(8) manual page for more information. November 23, 2024