# BHyve desktops + easy access to host data



## stratacast1 (Mar 22, 2018)

I'm getting to a point where I want to switch my desktop to FreeBSD, but can't yet because there are some specific applications that I use that are Linux only. I'd like to simply just run FreeBSD as my host OS and have a Linux guest(s), but the thing is, some of the applications I use require access to many gigabytes of data which I don't want to be locked into any Linux guest. So what I'm wondering is, can I have a reasonably snappy Linux desktop guest in BHyve (plus windows 10 for that matter) and also have an easy way to pass the data on the host to the VMs?


----------



## usdmatt (Mar 22, 2018)

There is no host/guest file access in bhyve, it's purely a hypervisor. You'd need to use a network file system for this. The obvious choice for Linux would be NFS although you'd probably need to use Samba for Windows.


----------



## stratacast1 (Mar 22, 2018)

usdmatt said:


> There is no host/guest file access in bhyve, it's purely a hypervisor. You'd need to use a network file system for this. The obvious choice for Linux would be NFS although you'd probably need to use Samba for Windows.



That was ultimately my assumption. I THINK I saw that Windows had NFS support in Windows 10, but with Windows data it isn't as dire that I have easy access to data vs a Linux guest. Would it then be possible to keep an NFS instance that is only accessible to my VMs?


----------



## ondra_knezour (Mar 22, 2018)

Following two may be useful, but probably only for testing or proof of concept in current stage of the development.

https://github.com/wca/p9fs
https://github.com/freenas/lib9p


----------



## aragats (Mar 22, 2018)

I use net/freerdp for everything related to Windows guest: shared folders, clippboard, sound, microphone:
	
	



```
xfreerdp -grab-keyboard /sec:rdp /bpp:24 /w:$WIDTH /h:$HEIGHT /v:$HOST /u:$USER /p:$PASSWD /clipboard /drive:home,/home/<myuserdir> /fonts /sound:sys:oss,dev:3 /microphone:sys:oss,format:1
```
Perfectly works.


----------



## stratacast1 (Mar 22, 2018)

Those are both very interesting ondra, I'd be curious to see where those go in the future as they become more stable. 

For freerdp, in the end I may be able to get away with just having a Windows guest and no Linux guest, since Windows has the missing software I need too. Otherwise, for a Linux guest I'd just VNC in right? I might give some test runs from my current setup and see how performance is. I assume it'd be about the same, since rdp is rdp, and vnc is vnc no matter what the host is...


----------



## aragats (Mar 23, 2018)

stratacast1 said:


> for a Linux guest I'd just VNC in right?


I think, it's overkill for a particular application. You can easily tunnel X via SSH. Just login via SSH:
	
	



```
% ssh -XYC <your_guest_host>
```
and run any graphical application then.
Check ssh(1) for the flags you may (or may not) want.


----------



## Oko (Mar 23, 2018)

usdmatt said:


> There is no host/guest file access in bhyve, it's purely a hypervisor. You'd need to use a network file system for this. The obvious choice for Linux would be NFS although you'd probably need to use Samba for Windows.


Not following your post. Bhyve is full virtualization. An example of pure hypervisor would be Xen. Xen 4.9 introduces a Xen transport for 9pfs so there is no need for clunky NFS. FreeBSD jails have nullfs(5)
The guy wants something similar for Bhyve. Sounds pretty reasonable to me. Sharing a common data pool among guests is a very frequently encountered in real world.


----------



## usdmatt (Mar 23, 2018)

> NAME
> bhyve – run a guest operating system inside a virtual machine
> 
> DESCRIPTION
> ...





> The guy wants something similar for Bhyve. Sounds pretty reasonable to me. Sharing a common data pool among guests is a very frequently encountered in real world.


That's very nice but bhyve doesn't have this ability, yet at least. There was experimental support for p9 (with only Linux guest afaik) but that doesn't seem to have gone very far. So at the moment the only solution to his problem is to use a network file system.


----------



## p3rj (Mar 23, 2018)

stratacast1 said:


> I might give some test runs from my current setup and see how performance is. I assume it'd be about the same, since rdp is rdp, and vnc is vnc no matter what the host is


With a Linux client, you might be able to use _x2go_, for which there is a port (x2goclient) of the client, if unmaintained. I've no experience with it in the context of bhyve, but with a physical headless Linux system, performance for me was pretty good. Does audio, too.
On the server side one is somewhat restricted with respect to the desktop environment, compositing WMs are not or poorly supported, I think. IIRC, _Mate_ worked fine.


----------



## stratacast1 (Mar 23, 2018)

I'll take a look at X11 over SSH, I have thought about that. The last time I tried it, I didn't have the best experience, but it was from a Pi over the network so...that could be my problem. I wouldn't have an issue with NFS if I can contain it to only being passed to my VMs which are in a NATed network ONLY. I also see that VirtualBox version 5 is on FreeBSD now? That would be another option I wouldn't mind testing


----------



## aragats (Mar 23, 2018)

stratacast1 said:


> The last time I tried it, I didn't have the best experience


Here with bridged network `iperf` shows about 5Gb/s for _bhyve_ host<->guest and guest<->guest.


----------



## stratacast1 (Mar 27, 2018)

aragats said:


> Here with bridged network `iperf` shows about 5Gb/s for _bhyve_ host<->guest and guest<->guest.



Would that be able to easily throw a whole GUI desktop my way, or will that just be fetching an application from a bhyve guest?


----------



## malco_2001 (Mar 27, 2018)

If its a Linux guest you can also use xdmcp.  Then something like X -query ip can forward the entire desktop.  Be aware sound emulation does not work yet.  I poked for sound emulation to be merged in the review a few weeks ago, and someone is working on adding capsicum support again to fix it in CURRENT.


----------



## aragats (Mar 27, 2018)

stratacast1 said:


> Would that be able to easily throw a whole GUI desktop my way, or will that just be fetching an application from a bhyve guest?


I run both Windows and Linux in bhyve. There is no problem getting the entire desktop, however, as I mentioned, IMO, there no reason to get the entire desktop of Linux.
Generally speaking, you can very roughly estimate the maximum bandwidth you may need assuming that you get completely uncompressed bitmaps. The actual protocols use this or that compression method, it will be significantly less.
So, for an HD desktop at 30fps and 24-bit color you'll need: 1080*1920*24*30≈1.4Mb/s.


----------



## sko (Mar 27, 2018)

For those linux-specific applications you might be able to use the linux compatibility layer within a jail (to keep the host clean...). IIRC the vmadm port from Project FiFo [1] wanted to introduce the concept of LX-jails (linux-branded jails; similar to LX-zones on smartOS). 
Don't know the status on that though, the FreeBSD-vmadm project didn't received any updates since ~4 months...

Speaking of LX-Zones: instead of running a fully-bloated linux desktop install inside bhyve, smartOS also runs very well on bhyve and provides very decent performance. LX-Zones are really great if you are stuck with a specific linux application, as their overhead is really small even compared to any container solution on linux itself. I'm running smartOS on bhyve on 2 hosts for testing/development and even with only 6GB RAM for the whole smartOS VM you can easily run 20+ zones as their resource overhead is amazingly small. E.g. our primary local DNS server (bind 9.11) that serves 12 zones to 8 subnets and 4 views runs with a total of ~300MB RAM for the zone.

As already mentioned, for graphical applications X forwarding is usually far more efficient than VNC, especially because you can handle the window just like any local one, so this should always be preferred over VNC if possible.


Regarding VirtualBox: It works, it has a "very colorful" GUI, the CLI interface is absolutely horrible and the overhead insane. Avoid it like the plague unless you can't use anything else (e.g. if you absolutely have to run Windows and need drag&drop/copy&paste between host and VM).


[1] https://gitlab.com/Project-FiFo/FiFo/vmadm


----------



## Vadim_Mkk (Oct 22, 2019)

Hi all.
This question very  interestig for me.
Synopsis.
Which variant  will be have  the better integral performance in my laptop with SSD I/O?
1. FreeBSD + bhyve with Windows guest with general applications lice MS Office + bhyve with Linux guest with Anaconda
2. Native Linux like Debian + Virtual Box with Windows guest 
How many overhead has  byhave  when it works with sporadic intensive  I/O opearation with SDD. Typical I/O activity -  isn't permanent intensive OLTP of database production - sometimes from network will be download dump of querys to external or internal database by conventional 1Gbe LAN , dump will analyse and after buildings consolidate report? On реу other hand somebody said that bhyve (type 2 Hypervisor)   have little overhead that VMware ESXi (VMVare declares that its overhead on the ESXSi in the real OLTP doesn't more 15% maximum  in comparison native OS), but the other hand  further translation fromRussian





"If the load on I / O is high or if you do not have counterarguments (dynamic migration, etc.), to make the system different from the host system OS or other architecture, it is preferable to use containerization. Despite the advertising slogans about 99% of virtual infrastructure from managers of individual commercial virtualization products, it is unlikely that any of them would prefer to purchase a virtual machine instead of a real one "
Anybody have real experience using bhyve with intensive disk i/O? How byhave does work in real production?
Just now I’m thinking what to choice in the finally - FreeBSD with byhave or native Debian? Overhead 10% is not critical.
Throughput 5 Gb/sec (625MB/sec) from byhave Linux guest  to NFS folder to host ZFS dataset - more than enough.
I  beginning user, but  I respect FreeBSD  for reliability like AK-47, integrity (cathedral), good documentation, ZFS support. Linux (IMHO) - wild eastern bazar.


----------



## Lex_P (Aug 8, 2020)

*Vadim_Mkk*

Is this a screenshot of some kind of private tool? I'm interested in it. Can it get it somewhere?


----------

