John Floren

Home | Blog | Tools
Back to blog archive

Posted 2021/2/13

Serve 9P from a FreeNAS jail

Note that this is unauthenticated, which is why you should 1) only do this on your home network, and 2) only point it at a new, purpose-made ZFS dataset rather than one which contains anything you care about.

Create a new jail

Make a new jail in FreeNAS. Be sure to select IPv4 autoconfigure/vnet (no NAT), because we need to connect to it from the LAN. Set up whatever dhcp/dns config is appropriate for your network–I named mine fs.floren.lan. Edit the jail and set it to start automatically.

Set up the storage

Create a new dataset named Harvey on one of your pools. This is what we’ll be serving over 9P. Edit the jail’s mount points, add a mount point using the new Harvey dataset as the source and /mnt as the destination.

Start a 9P server

In the jail, run these commands:

pkg install go
pkg install git
(installing git apparently pulls in python AND perl which is impressive)
go get github.com/harvey-os/go/cmd/ufs
./go/bin/ufs -root /mnt/ -addr ":564"	# This is just to test that it works

From your Harvey/Plan 9 system:

srv fs.floren.lan fs
mount -c /srv/fs /n/fs

Start 9P automatically

Once you’ve verified that this is working, the lazy way to start UFS automatically in the jail is to create /etc/rc.local, set it executable, and put the following in it:

#!/bin/sh
/root/go/bin/ufs -root /mnt -addr ":564"

Notes

If you’re running Plan 9/9legacy/9front/9atom (i.e. not Harvey), you may wish to add -user glenda to the ufs invocation above.