From owner-freebsd-fs@FreeBSD.ORG Sat Dec 27 14:19:18 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CB2D883 for ; Sat, 27 Dec 2014 14:19:18 +0000 (UTC) Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) (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 A57FF66525 for ; Sat, 27 Dec 2014 14:19:17 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id l18so15884027wgh.40 for ; Sat, 27 Dec 2014 06:19:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=/zZWYchlsfS4eUgUxBLQJr6/N8imykw9k9ln4hp+mRM=; b=CbxlQSbnpTKzhaZYDWhUiOfVUdU+Zkl+kW+cqGQvtT7R/MkY/pPCxE+YYumgctFKXr 6wX0/gbXL5lWFw4U3k4swmTiRNT6/qbx10dfxyP5OONxGFgtz7+MwgMqC4fiXuQrXwAn BO09COvFPh034XT6ayJrGv0iK1iANpJeaBHtmZOTKggZDDY3yG+GRbs4RkZw9e7OL7HY E2qXQCI85IRv6jlrNNVdwsO8ra48Xl2gP2GYiruLschZC//ziIyslZqr/uBJrka4KptP COB6+VFWv3WCj2AsKTeA/3L2KG6zq9XWv6BnJ/GfqxCuAk4OkO5jHEwcD2oQPGnO3fwX /WkA== X-Gm-Message-State: ALoCoQllc7bmMj2dDGdSgdNP5KhTHxzPZSVseyQpS0CLlxYHn8zSMXYCBvy1vUrEBRQeJvY9/sc1 X-Received: by 10.180.9.241 with SMTP id d17mr78445387wib.13.1419689955654; Sat, 27 Dec 2014 06:19:15 -0800 (PST) Received: from [10.10.1.68] (82-69-141-170.dsl.in-addr.zen.co.uk. [82.69.141.170]) by mx.google.com with ESMTPSA id d2sm42393707wjs.32.2014.12.27.06.19.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Dec 2014 06:19:14 -0800 (PST) Message-ID: <549EBFD9.8090407@multiplay.co.uk> Date: Sat, 27 Dec 2014 14:19:05 +0000 From: Steven Hartland User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: freebsd-fs@freebsd.org Subject: Re: ZFS: Mount partition from ZVOL with volmode=dev References: <91E1211B-7E84-472B-8098-630AE8C97251@gmail.com> <32BEFAB7-936E-42F0-AE75-FB978C13885C@gmail.com> In-Reply-To: <32BEFAB7-936E-42F0-AE75-FB978C13885C@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 14:19:18 -0000 On 27/12/2014 13:18, Paul Chakravarti wrote: >> On 26/12/2014 23:54, Paul Chakravarti wrote: >>> Hello, >>> >>> I am using a ZVOL configured with 'volmode=dev' 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’t show up under /dev/zvol as separate devices with >>> 'volmode=dev' 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=dev 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’t exposed to geom. That's exactly what volmode=dev does, if you want geom ones don't specify volmode. > On the host system: > > # zfs create -V10G -o volmode=dev 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 > => 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 > UFS partition on the host with volmode=guest - with volmode=default (ie. geom There is no volmode=guest, where did you get that from? > when vfs.zfs.vol.mode=1) 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’t 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 > rc.conf parameters before passing to bhyve) > > volmode=default | 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=default (geom - vfs.zfs.vol.mode=1) 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=dev. What error do you get? Regards Steve