Premise
On Windows, Windows Subsystem for Linux — I use WSL 2, but this also applies for WSL 1, as I understand it — makes the guest Linux instance's filesystems available to the Windows host over 9p, specifically 9p2000.L. Is there a way to do something similar between a VirtualBox guest OS and host OS? I'm interested in this for multiple host OSes, including:
- macOS
- Windows
and multiple guest OSes, including:
- macOS
- FreeBSD
- Linux
- Later on, when I'm a bit braver and ready to mess with them:
-
(Mostly/partly an aside: Yes, I know it mostly looks like the project's dead, but the web site's out of date. Most activity's on the project's Discord server right now. The most exciting thing to happen in recent memory is when beeselmane managed to get macOS to boot after he replaced the XNU kernel Apple ships in it with one he built from source, but that was mid-2022.)
ravynOS (web site, GitHub repository)
(ravynOS is based on FreeBSD, so the answer for that might work for it for now. macOS compatibility in ravynOS is a looong way off, so the macOS answer won't work for ravynOS yet.)
-
(Feel completely free to focus on the more well-known and well-maintained of these; I'm not asking for undue effort here.)
Some potential avenues of inquiry I'm aware of are:
9p, as used by WSL2 as mentioned before.
virtio
(Note:
- macOS has had some basic virtio functionality since macOS Mojave 10.14, including a virtio-backed 9p kext. I'm not sure if that last's a server, client, or both, though.)
VirtFS
Not virtiofs, as its most prominent documentation states that it's for sharing files from a host OS to a guest OS, instead of the other way around like I want.
virt-manager, maybe…?
SSHFS
(Answers may pick between using one or more of these as the solution they cover.) Additionally, I know that QEMU/KVM have virito/9p support, but I'd like to know/see if the sort of file-sharing arrangement I'm looking for is possible with VirtualBox. I'm familiar with it, and it's easier to set up, at least in the sense that you don't have to modify raw configuration files or execute CLI commands.
Background Rationale
The reason I'd like to know how to share a VM guest OS's filesystem contents with a host OS is:
For:
- Kernel and OS development
- Maybe kernel extension development in the future
Where the performance overhead comes into play:
- When the host OS accesses files in the guest OS's filesystem,
- Not every time when the guest OS needs to access build and other project files.
I don't want to store build/project files somewhere on a host OS filesystem location, thus forcing the guest OS to encounter the performance overhead and cost of having to round-trip through the file-sharing mechanism in use. Guest OS accesses to filesystem locations within its containing VM disk image are what should get close-to-native/-raw performance, or at least closer-to-native or higher performance.