Other How to properly mount a directory via 9p (plan9) in the bhyve of a FreeBSD guest?

Hello.
Host: FreeBSD 14.1
bhyve guest: FreeBSD 14.1

How is it possible to mount a directory via 9p protocol in a freebsd guest?
I'm using the vm-bhyve wrapper.

The official vm-bhyve documentation says:
VM guest conf:
Code:
disk1_type="virtio-9p"
disk1_name="cache=/var/cache/pkg/"
disk1_dev="custom"

Mount in guest freebsd:
Code:
# mount -t 9p -o trans=virtio cache /var/cache/pkg
mount: cache: Invalid fstype: Invalid argument

How to mount the 9p directory correctly?
 
On FreeBSD 15-current it is possible to mount via the module /boot/kernel/virtio_p9fs.ko

Code:
/boot/loader.conf
virtio_p9fs_load=YES

mount -t p9fs cache /mnt

But on FreeBSD 14, this module does not exist.
 
On FreeBSD 15-current it is possible to mount via the module /boot/kernel/virtio_p9fs.ko

Code:
/boot/loader.conf
virtio_p9fs_load=YES

mount -t p9fs cache /mnt

But on FreeBSD 14, this module does not exist.
It does at least as of 14.4:

sh:
-> freebsd-version
14.4-RELEASE-p1
-> ls -l /boot/kernel/virtio_p9fs.ko
-r--r--r--  2 root wheel uarch   34K Mar  6 05:09 /boot/kernel/virtio_p9fs.ko

Which most probably means that you need at least such a host to export a 9p mount to a guest; and then the guest also needs 9p support to mount that, of course, thus raising the bar equally for the guest.
 
you don't need virtio_p9fs on the host system, only the guest which is mounting the filesystem. exporting is handled internally in bhyve and does not rely on kernel support.

also, security support for FreeBSD 14.1 ended over a year ago; you should upgrade to a supported release, such as 14.4.
 
Back
Top