Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Sep 2025 19:07:04 +0000
From:      Jonathan Vasquez <jon@xyinn.org>
To:        freebsd-virtualization@freebsd.org
Subject:   Re: bhyve rw access to host filesystem?
Message-ID:  <UaUXle1tDZs3111Mg2mbnPCQjx2qa1nUvGQgrcgnCbs5rqWr5cXDkDhfYHbyXfF2q5RJWpefuOzhY65cuFt-qpJq-ysK6C9VXWiuLu0nOVI=@xyinn.org>
In-Reply-To: <CAFDf7UKSgkDf3j1amhmNwY3CTGKHNONVahjAQCkH7hBVhTQf9A@mail.gmail.com>
References:  <aMAjoodDyaJIahJl@int21h> <aMAwFNbSSfKAGh5D@amaryllis.le-fay.org> <CAFDf7UKSgkDf3j1amhmNwY3CTGKHNONVahjAQCkH7hBVhTQf9A@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Yea definitely. Windows is actually my main use case where I need to share files between the host and guest.

Jonathan Vasquez
PGP: 34DA 858C 1447 509E C77A D49F FB85 90B7 C4CA 5279
Sent with ProtonMail Secure Email

Sent from [Proton Mail](https://proton.me/mail/home) for Android.

-------- Original Message --------
On Tuesday, 09/09/25 at 14:34 Nuno Teixeira <eduardo@freebsd.org> wrote:

> Hello,
> I have have already tried it with a linux (debian) guest and it works fine too.
> I'm looking for p9fs support on windows guests but for what I digged, there is no 9p support yet but I also found that microsoft uses it on linux subsystem...
> If you know a program that do 9p on windows, please share.
> Thanks,
>
> Lexi Winter <ivy@freebsd.org> escreveu (terça, 9/09/2025 à(s) 14:48):
>
>> void:
>>> I'd like to have one bhyve vm access the bhyve *host's* filesystem
>>
>> this is what p9fs(4) is for.
>>
>>> I can't seem to find instructions how to do this, although 9p looks
>>> promising, am not sure this can be accessed from the host.
>>
>> p9fs exports an existing directory tree from the host (similar to the
>> NFS server), so the host can always access the files by definition.
>>
>> to export the filesystem, add a virtio-9p device to bhyve:
>> bhyve [...] -s 5:0,virtio-9p,myshare=/some/path,rw
>> 'myshare' should be replaced with a descriptive name for the share,
>> and change 'rw' to 'ro' to make it read-only.
>>
>> in the guest, mount the filesystem as normal in /etc/fstab using the
>> same share name:
>> myshare /myshare p9fs rw 0 0
>>
>> note that unlike NFS, this doesn't work automatically for descendent
>> mountpoints on the host (e.g., ZFS filesystem hierarchies); instead
>> you need to export and mount each child filesystem separately.
>>
>> this is compatible on both the host and guest side with virtio-9p in
>> Linux and other operating systems, but not with the newer version
>> which i can't remember the name of (VirtFS?).
>
> --
>
> Nuno Teixeira
> FreeBSD UNIX: <eduardo@FreeBSD.org> Web: [https://FreeBSD.org](https://freebsd.org/)
[-- Attachment #2 --]
<html><head></head><body>Yea definitely. Windows is actually my main use case where I need to share files between the host and guest.<br><br><div class="protonmail_signature_block-user"><div>Jonathan Vasquez<br></div><div>PGP: 34DA 858C 1447 509E C77A  D49F FB85 90B7 C4CA 5279<br></div><div>Sent with ProtonMail Secure Email<br></div><div><br></div></div><br><br>Sent from <a target="_blank" href="https://proton.me/mail/home" rel="noreferrer">Proton Mail</a> for Android.<div class="protonmail_quote"><br><br>-------- Original Message --------<br>On Tuesday, 09/09/25 at 14:34 Nuno Teixeira &lt;eduardo@freebsd.org&gt; wrote:<br><blockquote class="protonmail_quote"><div dir="ltr"><div><div><div><div>Hello,<br><br></div>I have have already tried it with a linux (debian) guest and it works fine too.<br></div>I'm looking for p9fs support on windows guests but for what I digged, there is no 9p support yet but I also found that microsoft uses it on linux subsystem...<br><br></div>If you know a program that do 9p on windows, please share.<br><br></div>Thanks,</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Lexi Winter &lt;<a rel="noreferrer">ivy@freebsd.org</a>&gt; escreveu (terça, 9/09/2025 à(s) 14:48):<br></div><blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px solid #ccc; padding-left: 1ex">void:<br>
&gt; I'd like to have one bhyve vm access the bhyve *host's* filesystem<br>
<br>
this is what p9fs(4) is for.<br>
<br>
&gt; I can't seem to find instructions how to do this, although 9p looks<br>
&gt; promising, am not sure this can be accessed from the host.<br>
<br>
p9fs exports an existing directory tree from the host (similar to the<br>
NFS server), so the host can always access the files by definition.<br>
<br>
to export the filesystem, add a virtio-9p device to bhyve:<br>
&nbsp; &nbsp; &nbsp; &nbsp; bhyve [...] -s 5:0,virtio-9p,myshare=/some/path,rw<br>
'myshare' should be replaced with a descriptive name for the share,<br>
and change 'rw' to 'ro' to make it read-only.<br>
<br>
in the guest, mount the filesystem as normal in /etc/fstab using the<br>
same share name:<br>
&nbsp; &nbsp; &nbsp; &nbsp; myshare&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/myshare&nbsp; &nbsp; &nbsp; &nbsp; p9fs rw 0 0<br>
<br>
note that unlike NFS, this doesn't work automatically for descendent<br>
mountpoints on the host (e.g., ZFS filesystem hierarchies); instead<br>
you need to export and mount each child filesystem separately.<br>
<br>
this is compatible on both the host and guest side with virtio-9p in<br>
Linux and other operating systems, but not with the newer version<br>
which i can't remember the name of (VirtFS?).<br>
</blockquote></div><div><br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><font color="#888888">Nuno Teixeira</font></div><div><div><font color="#888888">
FreeBSD UNIX:&nbsp; &lt;eduardo@FreeBSD.org&gt;&nbsp; &nbsp;Web:&nbsp; <a href="https://freebsd.org/" rel="noreferrer" target="_blank">https://FreeBSD.org</a><br></font></div></div></div></div>;
</blockquote></div>
                    </body></html>
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?UaUXle1tDZs3111Mg2mbnPCQjx2qa1nUvGQgrcgnCbs5rqWr5cXDkDhfYHbyXfF2q5RJWpefuOzhY65cuFt-qpJq-ysK6C9VXWiuLu0nOVI=>