From owner-freebsd-virtualization@freebsd.org Mon Feb 11 23:22:27 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 6016714E6D1E for ; Mon, 11 Feb 2019 23:22:27 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from bs1.fjl.org.uk (bs1.fjl.org.uk [84.45.41.196]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bs1.fjl.org.uk", Issuer "bs1.fjl.org.uk" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id ECFDC8E7EF for ; Mon, 11 Feb 2019 23:22:26 +0000 (UTC) (envelope-from freebsd-doc@fjl.co.uk) Received: from [192.168.1.35] (host81-153-12-168.range81-153.btcentralplus.com [81.153.12.168]) (authenticated bits=0) by bs1.fjl.org.uk (8.14.4/8.14.4) with ESMTP id x1BN3eA6050742 for ; Mon, 11 Feb 2019 23:03:42 GMT (envelope-from freebsd-doc@fjl.co.uk) Subject: Re: mounting/exporting/importing a zfs volume To: "freebsd-virtualization@freebsd.org" References: <20190211170312.GA76683@admin.sibptus.ru> From: Frank Leonhardt Message-ID: <4465134c-ae48-d39b-dd87-9514da577cc2@fjl.co.uk> Date: Mon, 11 Feb 2019 23:03:41 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190211170312.GA76683@admin.sibptus.ru> Content-Language: en-GB X-Rspamd-Queue-Id: ECFDC8E7EF X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Mon, 11 Feb 2019 23:22:27 -0000 On 11/02/2019 17:03, Victor Sudakov wrote: > Dear Colleagues, > > vm-bhyve keeps virtual machines on zfs volumes with volmode=dev. How can > I access/mount the filesystems within the volume when the virtual host > is offline? > > If I kept virtual disks in raw files, I could access them as devices > with mdconfig. But: > > root@newserv:~ # mdconfig -a -f /dev/zvol/zroot/vm/mail/disk0 > mdconfig: /dev/zvol/zroot/vm/mail/disk0 is not a regular file > root@newserv:~ # > > Also, how can I exchange those zfs volumes for use with other > hypervisors? They are not real raw disk files so I cannot use > sysutils/vmdktool etc. > I don't know this, but I'll guess(!) If you've set volmode to dev then you get a cdev device in devfs, and you'll never get it to mount. Try using geom instead (which IIRC is the default). HOWEVER, I suspect you're doing this because you're hoping that a ZFS volume is faster than a file.  I went through this, in the hope it wouldn't do CoW and would therefore be a lot better for databases. I was disappointed! Bascially, it's no better than a ZFS file. If that was your plan, use a UFS partition. I don't use ZFS volumes any more; I think they're more useful on Solaris. A md mapped on to a ZFS file seems to be the BSD way, and for VMs just use a file in its own dataset. You can then clone the dataset. Just what you need for nearly identical VMs. Regards, Frank.