From owner-freebsd-virtualization@freebsd.org Sun May 12 17:27:42 2019 Return-Path: Delivered-To: freebsd-virtualization@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42880159CF8C for ; Sun, 12 May 2019 17:27:42 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 158918110F for ; Sun, 12 May 2019 17:27:30 +0000 (UTC) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4CHRKiS037393; Sun, 12 May 2019 10:27:20 -0700 (PDT) (envelope-from freebsd-rwg@gndrsh.dnsmgr.net) Received: (from freebsd-rwg@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4CHRKPW037392; Sun, 12 May 2019 10:27:20 -0700 (PDT) (envelope-from freebsd-rwg) From: "Rodney W. Grimes" Message-Id: <201905121727.x4CHRKPW037392@gndrsh.dnsmgr.net> Subject: Re: [vm-bhyve] adding existing vm instances to the vm-bhyve system In-Reply-To: <20190512110609.GA15384@rpi3.zyxst.net> To: tech-lists Date: Sun, 12 May 2019 10:27:20 -0700 (PDT) CC: freebsd-virtualization@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 158918110F X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [0.58 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.41)[-0.414,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.08)[0.081,0]; NEURAL_HAM_LONG(-0.03)[-0.029,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[gndrsh.dnsmgr.net,gndrsh.dnsmgr.net]; RCPT_COUNT_TWO(0.00)[2]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.05)[ip: (0.16), ipnet: 69.59.192.0/19(0.08), asn: 13868(0.06), country: US(-0.06)] X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 17:27:42 -0000 > 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) loader="bhyveload" cpu=4 memory=2048M network0_type="virtio-net" network0_switch="trunked" #disk0_name="/home/ISO/x/FreeBSD-13.0-CURRENT-amd64-20181213-r342020-disc1.iso" #disk0_dev="custom" #disk0_type="ahci-hd" disk0_type="ahci-hd" disk0_name="disk0.img" wiredmem=1 network0_mac="58:9c:fc:00:ce:7f" 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@freebsd.org