yuichiro-naito / bmd

Bhyve Management Daemon
BSD 2-Clause "Simplified" License
13 stars 1 forks source link

Mount host dir to guest vm #8

Open johndo100 opened 2 months ago

johndo100 commented 2 months ago

I want to know how to mount host directory to guest vm.

Please help.

yuichiro-naito commented 1 month ago

One way is to use network file systems such as NFS or SAMBA. These protocols may work for you if your VMs have network connectivity to the host OS. If you intend to use a virtio-9p device, the bmd doesn't support it now. I'm planning to add the configurations for virtio-9p. The guest FreeBSD is now able to use it by the following commit. It looks so fun.

https://cgit.freebsd.org/src/commit/?id=e97ad33a89a78f55280b0485b3249ee9b907a718

johndo100 commented 1 month ago

Yes. Virtio-9p is exactly what I use to mount host dir when I'm on byhve-vm. Jail manager apps usually use something call nullfs but I'm not sure. Sorry my knowledge about it is little.

yuichiro-naito commented 1 month ago

I added 'sharefs' keyword to the VM configuration. It has "[sharename] = [pathname]" value which is passed to the virtio-9p device.

I'm feeling sharing a file system is not a block device. Of course, virtio-9p is one of PCI device of the VM, but it's an implementation matter. For VM users, it looks easy to understand that 'disk' is used for block devices, and 'sharefs' is used for file systems.

https://github.com/yuichiro-naito/bmd/commit/bdf1864d2c3a742b8236ece9d00a510be700fc9c

This feature will be included in the next release.