P9FS(4) FreeBSD Kernel Interfaces Manual P9FS(4)
NAME
p9fs, virtio_p9fs - 9P file system
SYNOPSIS
To use this filesystem, either add the following to the kernel config:
options P9FS
device virtio_p9fs
Alternatively, load the driver as a kernel module, either at boot time by
adding the following to loader.conf(5):
virtio_p9fs_load="YES"
or on system startup using the command:
# sysrc kld_list+=virtio_p9fs
DESCRIPTION
The p9fs filesystem uses the 9P protocol to mount a host file system
directory into a bhyve(8) guest. Multiple host directories can be
accessed using the bhyve(8) virtio-9p virtual PCI device. Each device is
configured with a share name and a host directory path. The share name
can be used with mount(8) to mount the host directory in the guest:
# mount -t p9fs mysharename /mnt
Host directories can be mounted on system startup using fstab(5) like
this:
mysharename /mnt p9fs rw 0 0
Using p9fs as a root file system is supported by adding the following to
loader.conf(5):
vfs.root.mountfrom="p9fs:mysharename"
LIMITATIONS
The 9P protocol relies on stateful file opens which map protocol-level
FIDs to host file descriptors. The FreeBSD vnode interface doesn't
support this and p9fs uses heuristics to guess the right FID to use for
file operations.
This can be confused by privilege lowering and does not guarantee that
the FID created for a given file open is always used, even if the calling
process is using the file descriptor from the original open call.
In particular, accessing unlinked files using open file descriptor may
not work correctly. If p9fs is the root filesystem, it is recommended to
use with tmpfs(5) to ensure that temporary files created in /tmp or
/var/tmp have the expected semantics.
SEE ALSO
fstab(5), mount(8)
HISTORY
The 9P protocol first appeared in the Plan 9 operating system. More
recently, the protocol has been widely used with virtual machines to
allow the use of host file resources inside a guest VM.
AUTHORS
This is derived from software released by Juniper Networks, Inc. with
many improvements and fixes from Steve Wills.
This manual page was written by Doug Rabson <dfr@FreeBSD.org>.
BUGS
A better name for this filesystem would be 9pfs but for technical
reasons, the names of filesystems must be valid C identifiers. As a
compromise, the filesystem is named p9fs.
FreeBSD 15.1-STABLE-HBSD May 18, 2026 P9FS(4)