From nobody Fri Mar 25 13:41:18 2022 X-Original-To: freebsd-fs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 391371A26BAF for ; Fri, 25 Mar 2022 13:41:30 +0000 (UTC) (envelope-from rincebrain@gmail.com) Received: from mail-vk1-xa2c.google.com (mail-vk1-xa2c.google.com [IPv6:2607:f8b0:4864:20::a2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KQ3CY3w0Xz3Jgx for ; Fri, 25 Mar 2022 13:41:29 +0000 (UTC) (envelope-from rincebrain@gmail.com) Received: by mail-vk1-xa2c.google.com with SMTP id l184so4277196vkh.0 for ; Fri, 25 Mar 2022 06:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GzpZL2vgldlzzXhIu2wAfxPdbme6luEZ9PYvrYUjjP8=; b=qi0fY2z8rPVKZe02bCtfIItsVkk3R0JONvsjhjsUHs5wWtAjAx8MDVAL/boZ0G50TG nVFO1v3HMHLNPDBh8BVXZeSxCnheUhyX7Zg/e7+6FLKW5Sbx+kQhZTLQgunTuzysH9mD 8M1P2Nu+RJ7T2i41qaYUbOpfkrUQZyTNReIMAbD2zSspyZa/HBundLcLOlpgQkjJl4dM cykfbZI/XtgXh+QgZ7G+OdLfx7oqj9OCqqLz4XiKNEFpxDakfXUMt1sZVDeZUlOaReru 1gbHjHKG1ywOegtEHCAt4sSoX4rIBxmDHo2VHq/l05KxVXGy78jmFpq8a7Ip4kcuIOff K8ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GzpZL2vgldlzzXhIu2wAfxPdbme6luEZ9PYvrYUjjP8=; b=MqAkxRlchwgvOGcwF+a+l09R44PsEm9x3RoQgWgJjcNWBBk+iqPsYcIrHxao0+h7dC jjbEEBhbVkCsuHmoKZi6vg/hsgGsWA1wwKl9+r0eVhR6BIx9zTyzcJ0MB/Pxytxl9a7v RtYuWrziajPEjdIRjISAUsxmNzdp3gfOZUPYItDyB+dSkU8fxK1zHIzyZAFw78DMT3BL WYaGxu7EJAM4bwFRJ+sTXgwbnxreiSMTavGo7Qhy2HrS7I0g4qp7reRBZ7eSz8VKMEHp MZmqnq5FqzPJjczEs32EU2s3LhQBE9a3Je0O93aAQduvrGcqlI4PyO5CcN/F/wc9zwtE A9Qw== X-Gm-Message-State: AOAM5320uwqZoVOLkfVCs2MhlTVy6M0H1wSxJ3Py7Q/QSz3j+CnnJogV zJAJ2ZykTgTdpuHd6ylUZJ4Bmuo0KU7j1DNu9XfogpOVv5A= X-Google-Smtp-Source: ABdhPJwS7ug5cDcunVKVOIsdDteAi0UUFPUy8H1FnwFhYkk8WjmHrwouhE3YBRF8AtlBVGxC6/ZT/2CzYI9MmvFy6U8= X-Received: by 2002:a1f:a40d:0:b0:33e:cc56:70c6 with SMTP id n13-20020a1fa40d000000b0033ecc5670c6mr4974136vke.27.1648215688859; Fri, 25 Mar 2022 06:41:28 -0700 (PDT) List-Id: Filesystems List-Archive: https://lists.freebsd.org/archives/freebsd-fs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-fs@freebsd.org MIME-Version: 1.0 References: <72AA1AC8-E623-4B73-A3F3-3FDB0ABDFCEA@jld3.net> In-Reply-To: <72AA1AC8-E623-4B73-A3F3-3FDB0ABDFCEA@jld3.net> From: Rich Date: Fri, 25 Mar 2022 09:41:18 -0400 Message-ID: Subject: Re: create zpool from zvols? To: John Doherty Cc: freebsd-fs Content-Type: multipart/alternative; boundary="000000000000a5d52605db0b1e44" X-Rspamd-Queue-Id: 4KQ3CY3w0Xz3Jgx X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=qi0fY2z8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rincebrain@gmail.com designates 2607:f8b0:4864:20::a2c as permitted sender) smtp.mailfrom=rincebrain@gmail.com X-Spamd-Result: default: False [-1.57 / 15.00]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; URI_COUNT_ODD(1.00)[3]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-0.997]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.58)[-0.575]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::a2c:from]; MLMMJ_DEST(0.00)[freebsd-fs]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --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 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
https://revi= ews.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 &q= uot;Allow zpools to use zvols as vdevs (DANGEROUS)", so it seems likel= y that it still can cause undesirable outcomes.

- Ri= ch



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 experimentati= on
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=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 -
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 -

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:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 ztest
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mirror
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zvol/zroot/zv0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 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
=C2=A0 =C2=A0pool: ztest
=C2=A0 state: ONLINE
=C2=A0 =C2=A0scan: none requested
config:

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

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 sin= ce I
wanted to do something like this.

Thanks for any enlightenment.

--000000000000a5d52605db0b1e44--