Re: create zpool from zvols?

From: Rich <rincebrain_at_gmail.com>
Date: Fri, 25 Mar 2022 13:41:18 UTC
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> 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.
>
>