Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2022 09:41:18 -0400
From:      Rich <rincebrain@gmail.com>
To:        John Doherty <bsdlists@jld3.net>
Cc:        freebsd-fs <freebsd-fs@freebsd.org>
Subject:   Re: create zpool from zvols?
Message-ID:  <CAOeNLurwC5-PygGjLSaCiShvjhvb1bvGiygSKJi2q6UxsGLDRQ@mail.gmail.com>
In-Reply-To: <72AA1AC8-E623-4B73-A3F3-3FDB0ABDFCEA@jld3.net>
References:  <72AA1AC8-E623-4B73-A3F3-3FDB0ABDFCEA@jld3.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000a5d52605db0b1e44
Content-Type: text/plain; charset="UTF-8"

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.
>
>

--000000000000a5d52605db0b1e44
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><a href=3D"https://reviews.freebsd.org/D4998">https://revi=
ews.freebsd.org/D4998</a> added a knob to allow you to do this even though =
it sometimes deadlocks, which is why it&#39;s off by default.<div><br></div=
><div>It&#39;s a FreeBSD-only tunable.<br><div><br></div><div>That tunable =
is still there in the post-OpenZFS FreeBSD, too, though it&#39;s labeled &q=
uot;Allow zpools to use zvols as vdevs (DANGEROUS)&quot;, so it seems likel=
y that it still can cause undesirable outcomes.<br><div><br></div><div>- Ri=
ch<br><div><br></div><div><br></div></div></div></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Mar 25, 2022=
 at 9:34 AM John Doherty &lt;<a href=3D"mailto:bsdlists@jld3.net">bsdlists@=
jld3.net</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex">Hello, I am using ZFS on FreeBSD 13.0-RELEASE-p8. For experimentati=
on <br>
and demonstration, I would like to create zpools using zvols as the <br>
underlying block devices.<br>
<br>
For example, I have these:<br>
<br>
[root@ibex] # zfs list -r -t volume zroot | grep zv<br>
zroot/zv0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8.25G=C2=A0 =C2=
=A0832G=C2=A0 =C2=A0 =C2=A0 =C2=A056K=C2=A0 -<br>
zroot/zv1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 8.25G=C2=A0 =C2=
=A0832G=C2=A0 =C2=A0 =C2=A0 =C2=A056K=C2=A0 -<br>
<br>
This seems as if it would do what I want:<br>
<br>
[root@ibex] # zpool create -n ztest mirror /dev/zvol/zroot/zv{0,1}<br>
would create &#39;ztest&#39; with the following layout:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ztest<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mirror<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zvol/zroot/zv0<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zvol/zroot/zv1<br>
<br>
But when I try to actually do it, it doesn&#39;t work:<br>
<br>
[root@ibex] # zpool create ztest mirror /dev/zvol/zroot/zv{0,1}<br>
cannot create &#39;ztest&#39;: no such pool or dataset<br>
<br>
FWIW, doing something similar on OmniOS works fine:<br>
<br>
[root@orca] # uname -srvp<br>
SunOS 5.11 omnios-r151040-852962cae3 i386<br>
[root@orca] # zfs create -V 2G rpool/zv0<br>
[root@orca] # zfs create -V 2G rpool/zv1<br>
[root@orca] # zpool create ztest mirror /dev/zvol/dsk/rpool/zv{0,1}<br>
[root@orca] # zpool status ztest<br>
=C2=A0 =C2=A0pool: ztest<br>
=C2=A0 state: ONLINE<br>
=C2=A0 =C2=A0scan: none requested<br>
config:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NAME=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0STATE=C2=A0 =C2=A0 =
=C2=A0READ WRITE CKSUM<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ztest=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ONLINE=C2=A0 =C2=A0 =C2=A0=
 =C2=A00=C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =C2=A00<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mirror-0=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ONLINE=C2=A0 =C2=A0 =C2=A0 =C2=
=A00=C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =C2=A00<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/dev/zvol/dsk/rpool/zv0=C2=
=A0 ONLINE=C2=A0 =C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =
=C2=A00<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/dev/zvol/dsk/rpool/zv1=C2=
=A0 ONLINE=C2=A0 =C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =C2=A00=C2=A0 =C2=A0 =
=C2=A00<br>
<br>
errors: No known data errors<br>
<br>
I thought I had done this in the past. Am I doing something wrong? Am I <br=
>
misremembering and this never worked?<br>
<br>
Using files created with truncate(1) rather zvols seems to work fine so <br=
>
maybe that&#39;s what I did before. Not sure, it&#39;s been a long time sin=
ce I <br>
wanted to do something like this.<br>
<br>
Thanks for any enlightenment.<br>
<br>
</blockquote></div>

--000000000000a5d52605db0b1e44--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOeNLurwC5-PygGjLSaCiShvjhvb1bvGiygSKJi2q6UxsGLDRQ>