From owner-freebsd-fs@FreeBSD.ORG Sat Dec 27 13:18:36 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6C9EDCB for ; Sat, 27 Dec 2014 13:18:36 +0000 (UTC) Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [IPv6:2a00:1450:400c:c00::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 55CA56424B for ; Sat, 27 Dec 2014 13:18:36 +0000 (UTC) Received: by mail-wg0-f44.google.com with SMTP id b13so15998885wgh.31 for ; Sat, 27 Dec 2014 05:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=wyUcLNmth3vBpeyIUmPR6zCs2e7o86ZVtrC3Hy1I7eo=; b=Jxu8SRYBLagw2jDFBa0sqyuI8m3SWG+OkbSu7k4Co1y+ycupg1i4/mT31eLs4riQfj sSWUwgzvZ432hkqSpD6j+LbUgC/ghSMTDCFvUi9lLxYmPDek8KBPtFVzuOwl3E6KUt18 VeWFXO7bUXG6RNpmlHGgMOX/d5Fv1FT+6ni/B25BlWzpYeWTVgIVN9JecoPTFp11eqVf 8dcEAGTB7R2MgBGZbeKTEJflIK5NPM4iSk/CSOKaptALqJPzGQUvXVHrKJGNo0jXY0gt xyyc/PIk5HAgNVpiICyJLcvMEH2AQCgtGQiplYJoTPGJKlTlL1tIjMN8lKv00wv/29O8 s84Q== X-Received: by 10.194.52.37 with SMTP id q5mr88819927wjo.39.1419686314796; Sat, 27 Dec 2014 05:18:34 -0800 (PST) Received: from [10.0.1.108] (cpc15-stav13-2-0-cust197.17-3.cable.virginm.net. [77.100.102.198]) by mx.google.com with ESMTPSA id gb10sm17024971wjb.21.2014.12.27.05.18.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Dec 2014 05:18:34 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: ZFS: Mount partition from ZVOL with volmode=dev From: Paul Chakravarti In-Reply-To: <91E1211B-7E84-472B-8098-630AE8C97251@gmail.com> Date: Sat, 27 Dec 2014 13:18:32 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <32BEFAB7-936E-42F0-AE75-FB978C13885C@gmail.com> References: <91E1211B-7E84-472B-8098-630AE8C97251@gmail.com> To: freebsd-fs@freebsd.org X-Mailer: Apple Mail (2.1993) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Dec 2014 13:18:36 -0000 >On 26/12/2014 23:54, Paul Chakravarti wrote: >> Hello, >> >> I am using a ZVOL configured with 'volmode=3Ddev' as the virtio disk = device for >> a bhyve instance (which works fine) but was trying to workout whether = there >> was any way of mounting the underlying partitions on the host system = - the >> partitions don=E2=80=99t show up under /dev/zvol as separate devices = with >> 'volmode=3Ddev' so was wondering is there is any other way of getting = at these >> other than mounting in a bhyve instance? >> >> Thanks, Paul > I cant reproduce this on HEAD r276067 > > zfs create -V 8192 -o volmode=3Ddev tank/tvol > root at head:src> ls -l /dev/zvol/tank/ > total 0 > crw-r----- 1 root operator 0x85 Dec 27 00:08 tvol > > Regards > Steve Hi, Sorry - I should have been clearer. The zvol shows up on the host system but the partitions aren=E2=80=99t exposed to geom. On the host system: # zfs create -V10G -o volmode=3Ddev tank/vps/vm0 # zfs list -o name,used,volmode tank/vps/vm0 NAME USED VOLMODE tank/vps/vm0 10.3G dev # ls -l /dev/zvol/tank/vps/ total 0 crw-r----- 1 root operator 0x7b Dec 27 13:30 vm0 The zvol mounted on the bhyve guest: # bhyveload -c /dev/nmdm0A -m 512M -d /dev/zvol/tank/vps/vm0 vm0 # bhyve -c 2 -m 512M -A -H -P -s 0:0,hostbridge -s = 1:0,virtio-net,tap0 -s 2:0,lpc -s 3:0,virtio-blk,/dev/zvol/tank/vps/vm0 = -l com1,/dev/nmdm0A vm0 On the bhyve guest this shows up as a geom device: root@vm0:~ # geom disk list Geom name: vtbd0 Providers: 1. Name: vtbd0 Mediasize: 10737418240 (10G) Sectorsize: 512 Mode: r2w2e3 descr: (null) ident: BHYVE-747A-2A76-FAC fwsectors: 0 fwheads: 0 And is partitioned in the guest as follows: root@vm0:~ # gpart show -p =3D> 34 20971453 vtbd0 GPT (10G) 34 1024 vtbd0p1 freebsd-boot (512K) 1058 19919872 vtbd0p2 freebsd-ufs (9.5G) 19920930 1048576 vtbd0p3 freebsd-swap (512M) 20969506 1981 - free - (991K) What I am trying to work out is whether there is any way I can mount the = guest=20 UFS partition on the host with volmode=3Dguest - with volmode=3Ddefault = (ie. geom when vfs.zfs.vol.mode=3D1) the device does show up as a geom provider = and you can just mount the partition from /dev/vol directly. The ZFS man page = suggests that you can=E2=80=99t but given that you can clearly mount from within a VM = was wondering is there is any way round this on the host (I am trying to clone a disk = device to run multiple bhyve instances but want to mount and modify some of the=20= rc.conf parameters before passing to bhyve) volmode=3Ddefault | geom | dev | none This property specifies how volumes should be exposed to the = OS. Setting it to geom exposes volumes as geom(4) providers, = providing maximal functionality. Setting it to dev exposes volumes only = as cdev device in devfs. Such volumes can be accessed only as raw = disk device files, i.e. they can not be partitioned, mounted, = participate in RAIDs, etc, but they are faster, and in some use scenarios = with untrusted consumer, such as NAS or VM storage, can be more = safe. Volumes with property set to none are not exposed outside ZFS, = but can be snapshoted, cloned, replicated, etc, that can be = suitable for backup purposes. Value default means that volumes exposition = is con- trolled by system-wide sysctl/tunable vfs.zfs.vol.mode, where = geom, dev and none are encoded as 1, 2 and 3 respectively. The = default values is geom. This property can be changed any time, but so = far it is processed only during volume creation and pool import. Using volmode=3Ddefault (geom - vfs.zfs.vol.mode=3D1) causes the = installer to fail when you try to create a UFS filesystem under bhyve - it is possible to = get round this by creating the partitions manually but my preference would = be to use volmode=3Ddev. Paul =20 =20=