RE: create zpool from zvols?

From: Michael Jung <mikej_at_paymentallianceintl.com>
Date: Fri, 25 Mar 2022 16:02:12 UTC
Hi!

I have never tried to use ZFS type 'volume' as a zpool but you can share a
zpool between zfs type 'filesystem' and type 'volume'.  Here I share two
type 'volume' stores as iscsi targets and one type 'filesystem' as a
zpool. If you interested in my iscsi config /etc/ctl.conf email me off list
to mikej@mikej.com.

ZFS raid-5400-1 is a simple 14 x raidz2 pool in my home lab.

root@draid:/raid-5400-1 # zfs list -t volume
NAME
                    USED  AVAIL  REFER  MOUNTPOINT
<SNIP>
raid-5400-1/esxi-store1  2.16T  3.51T   443G  -
raid-5400-1/unitrends1   1.08T  2.70T   171G  -
<SNIP>

root@draid:/raid-5400-1 # zfs list -t filesystem
NAME                              USED  AVAIL  REFER  MOUNTPOINT
<SNIP>
raid-5400-1                      3.24T  1.79T   236K  /raid-5400-1
<SNIP>

Since your experimenting - I am too. (for the curios while slightly
off topic) I have been testing ZFS Draid - here is how that pool looks.

root@draid:/raid-5400-1 # zpool list -v tank
NAME                 SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
tank                18.5T  8.02T  10.4T        -         -     0%    43%  1.00x    ONLINE  -
  draid2:2d:10c:0s-0  9.03T  4.06T  4.97T        -         -     0%  44.9%      -    ONLINE
    gpt/da0p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d10p1           -      -      -        -         -      -      -      -    ONLINE
    da39p1              -      -      -        -         -      -      -      -    ONLINE
    da40p1              -      -      -        -         -      -      -      -    ONLINE
    da41p1              -      -      -        -         -      -      -      -    ONLINE
    da43p1              -      -      -        -         -      -      -      -    ONLINE
    da44p1              -      -      -        -         -      -      -      -    ONLINE
    da42p1              -      -      -        -         -      -      -      -    ONLINE
    da45p1              -      -      -        -         -      -      -      -    ONLINE
    gpt/d19p1           -      -      -        -         -      -      -      -    ONLINE
  draid2:2d:10c:0s-1  9.03T  3.96T  5.07T        -         -     0%  43.8%      -    ONLINE
    da46p1              -      -      -        -         -      -      -      -    ONLINE
    gpt/d11p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d12p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d13p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d14p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d15p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d16p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d17p1           -      -      -        -         -      -      -      -    ONLINE
    gpt/d18p1           -      -      -        -         -      -      -      -    ONLINE
    da18p1              -      -      -        -         -      -      -      -    ONLINE
special                 -      -      -        -         -      -      -      -         -
  mirror-3           398G  2.86G   395G        -         -     0%  0.71%      -    ONLINE
    gpt/special0        -      -      -        -         -      -      -      -    ONLINE
    gpt/special1        -      -      -        -         -      -      -      -    ONLINE
logs                    -      -      -        -         -      -      -      -         -
  mirror-2          15.5G   256K  15.5G        -         -     0%  0.00%      -    ONLINE
    gpt/slog0           -      -      -        -         -      -      -      -    ONLINE
    gpt/slog1           -      -      -        -         -      -      -      -    ONLINE




CONFIDENTIALITY NOTE: This message is intended only for the use
of the individual or entity to whom it is addressed and may
contain information that is privileged, confidential, and
exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby
notified that any dissemination, distribution or copying
of this communication is strictly prohibited. If you have
received this transmission in error, please notify us by
telephone at (502) 212-4000 or notify us at: PAI, Dept. 99,
2101 High Wickham Place, Suite 101, Louisville, KY 40245



From: owner-freebsd-fs@freebsd.org [mailto:owner-freebsd-fs@freebsd.org] On Behalf Of John Doherty
Sent: Friday, March 25, 2022 9:50 AM
To: Rich <rincebrain@gmail.com>
Cc: freebsd-fs <freebsd-fs@freebsd.org>
Subject: Re: create zpool from zvols?

Thanks for the super-quick response. I guess I'll just use plain files
then. I don't really want to use the zpools for anything, I just want an
easy way to experiment with and demonstrate zpool create commands.

FWIW, the tunable does allow the "zpool create" command to work:

[root@ibex] # sysctl vfs.zfs.vol.recursive
vfs.zfs.vol.recursive: 1
[root@ibex] # zpool create ztest mirror /dev/zvol/zroot/zv{0,1}
[root@ibex] # zpool status ztest
pool: ztest
state: ONLINE
config:

NAME STATE READ WRITE CKSUM
ztest ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
zvol/zroot/zv0 ONLINE 0 0 0
zvol/zroot/zv1 ONLINE 0 0 0

errors: No known data errors

On Fri 2022-03-25 07:41 AM MDT -0600, <rincebrain@gmail.com<mailto:rincebrain@gmail.com>> wrote:

> https://reviews.freebsd.org/D4998<https://reviews.freebsd.org/D4998> added a knob to allow you to do this
> even
> though it sometimes deadlocks, which is why it's off by default.
>
> It's a FreeBSD-only tunable.
>
> That tunable is still there in the post-OpenZFS FreeBSD, too, though
> it's
> labeled "Allow zpools to use zvols as vdevs (DANGEROUS)", so it seems
> likely that it still can cause undesirable outcomes.
>
> - Rich
>
>
>
> On Fri, Mar 25, 2022 at 9:34 AM John Doherty <bsdlists@jld3.net<mailto:bsdlists@jld3.net>>
> wrote:
>
>> Hello, I am using ZFS on FreeBSD 13.0-RELEASE-p8. For experimentation
>> and demonstration, I would like to create zpools using zvols as the
>> underlying block devices.
>>
>> For example, I have these:
>>
>> [root@ibex] # zfs list -r -t volume zroot | grep zv
>> zroot/zv0 8.25G 832G 56K -
>> zroot/zv1 8.25G 832G 56K -
>>
>> This seems as if it would do what I want:
>>
>> [root@ibex] # zpool create -n ztest mirror /dev/zvol/zroot/zv{0,1}
>> would create 'ztest' with the following layout:
>>
>> ztest
>> mirror
>> zvol/zroot/zv0
>> zvol/zroot/zv1
>>
>> But when I try to actually do it, it doesn't work:
>>
>> [root@ibex] # zpool create ztest mirror /dev/zvol/zroot/zv{0,1}
>> cannot create 'ztest': no such pool or dataset
>>
>> FWIW, doing something similar on OmniOS works fine:
>>
>> [root@orca] # uname -srvp
>> SunOS 5.11 omnios-r151040-852962cae3 i386
>> [root@orca] # zfs create -V 2G rpool/zv0
>> [root@orca] # zfs create -V 2G rpool/zv1
>> [root@orca] # zpool create ztest mirror /dev/zvol/dsk/rpool/zv{0,1}
>> [root@orca] # zpool status ztest
>> pool: ztest
>> state: ONLINE
>> scan: none requested
>> config:
>>
>> NAME STATE READ WRITE CKSUM
>> ztest ONLINE 0 0 0
>> mirror-0 ONLINE 0 0 0
>> /dev/zvol/dsk/rpool/zv0 ONLINE 0 0 0
>> /dev/zvol/dsk/rpool/zv1 ONLINE 0 0 0
>>
>> errors: No known data errors
>>
>> I thought I had done this in the past. Am I doing something wrong? Am
>> I
>> misremembering and this never worked?
>>
>> Using files created with truncate(1) rather zvols seems to work fine
>> so
>> maybe that's what I did before. Not sure, it's been a long time since
>> I
>> wanted to do something like this.
>>
>> Thanks for any enlightenment.

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.