[vm-bhyve] adding existing vm instances to the vm-bhyve system

Rodney W. Grimes freebsd-rwg at gndrsh.dnsmgr.net
Sun May 12 17:27:42 UTC 2019

> Hi,
> How would one import a freebsd or linux vm currently running on a
> freebsd-12 server into vm-bhyve management? I can see lots of
> instructions for starting from fresh, but none for import of existing.
> Is this possible?
> The guests are currently running as per
> https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/virtualization-host-bhyve.html
> in screen. Some guests are file-backed, others zvol-backed.
> thanks,
> J.

This is possible, and not overly complex, but also non-trivial to do.
First some preliminary data collection and issue resolution needs to
be done.

a)  vm-bhyve assumes each vm lives in a directory by itself, and the
    collection of vm's all share a common parent.  If your setup is
    not like this you need to try and bring it to this form.

b)  vm-bhybe wants to, but does not have to, manage all your tap
    devices, creating and destroying them as you go, sorting this
    out between /etc/rc.conf methods and vm-bhyve methods can be
    messy if you have done anything very fancy.

The mechanics once this much is done is a matter of writting a
fairly direct translation of your bhyve(8) command into a .conf
file that vm-bhyve uses.

Something like this for my
more fb-bld-13-amd64/fb-bld-13-amd64.conf
(Note:  The directory name and .conf file name must match for
vm-bhyve to work, which makes an easy way to make vms disappear
from its management by changing either name)


I picked this sample specifically as it shows how to refer to a "disk"
that is not in the home directory of the vm by using the _dev=custom
option, which you may very well need to do for some of your vms.

You do not need to put the *_mac stuff in there, vmbhyve well automagically
add those for you.

Personally I have migrated both my self managed bhyve stuff, and almost all of
my ESXi based FreeBSD vm's to vm-bhyve. 
Rod Grimes                                                 rgrimes at freebsd.org

More information about the freebsd-virtualization mailing list