From nobody Sun Jan 9 09:28:00 2022 X-Original-To: questions@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 458261929AAB for ; Sun, 9 Jan 2022 09:28:43 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) Received: from holgerdanske.com (holgerdanske.com [184.105.128.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "holgerdanske.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JWs8V1Fybz3t8x for ; Sun, 9 Jan 2022 09:28:42 +0000 (UTC) (envelope-from dpchrist@holgerdanske.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=holgerdanske.com; s=nov-20210719-112354; t=1641720503; bh=PzjPbUyf+v0xHYWG2n3p1mUbw11pCASdFkyBACR7nVY=; h=Received:Subject:To:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding; b=oylL43iCD9pvudhaAPv7NbLTieoXnps9mM08mql8nKYQaLBJscVUgKFYMPm80Dz4t YPc3op7Qsh1XrDFGJ0OxwGfou8PdPiWRXGoIZvA87a7T+sSS0RngxwmjterrK/pbB5 Xpo2EeV3jzbg3MhR0Al10O5JpG6XQFiDwnI99lJDzAaiixMY2a2dX5wXBnAvsJ67D3 x4CrywZM4etfELmXk8vnq3omgTLFbrVkyOv0UTqw+08EBjaZcbfMRRCfdtkqoajVra t4jm3qqkZ6MQ/9ht4ubT7jBqEXsnra5xJpqYEQvzrG1/ycv0mkr1cobTIa1pzwUrXN B+uQnFgOY5p5VjFjFz+xSbHFkYh+JxUwAnI0vjNSCF3QVbFlrjmWG6BiUv1egABJ4y keyr3aJQ31SxsuB6kvblxoDSoPN80omk7AXRvifaRjlZxWE/CH4lhqsdkw0KFKHaXC O+DVkR8JJrh2Lfy3zOgIKlGwZAlGR/qyQl0JniXjPbks5woCJnaDQKwfBJ5SaC26Xn DlXQUScFQzEM5vbKNmAQ+gPeSJgqYY3UX0rezB3QAWzAbOV2y1g0Hd+o08JaaD1gPT ULd5FZnq9+FgFKkKdNxzJurENg/eoLLEi3uCAJ8y6N7349jhMZjdiv1tjgGHDKt5zh 2/dyzIPdlplyBN1NvTZ1ybUk= Received: from 99.100.19.101 (99-100-19-101.lightspeed.frokca.sbcglobal.net [99.100.19.101]) by holgerdanske.com with ESMTPSA (TLS_AES_128_GCM_SHA256:TLSv1.3:Kx=any:Au=any:Enc=AESGCM(128):Mac=AEAD) (SMTP-AUTH username dpchrist@holgerdanske.com, mechanism PLAIN) for ; Sun, 9 Jan 2022 01:28:08 -0800 Subject: Re: Can I add a raidz vdev as a mirror of existing vdevs To: questions@freebsd.org References: <81940818-6aaf-1a11-dd71-86eb5c51cab5@bluerosetech.com> From: David Christensen Message-ID: Date: Sun, 9 Jan 2022 01:28:00 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 In-Reply-To: <81940818-6aaf-1a11-dd71-86eb5c51cab5@bluerosetech.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4JWs8V1Fybz3t8x X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=holgerdanske.com header.s=nov-20210719-112354 header.b=oylL43iC; dmarc=pass (policy=none) header.from=holgerdanske.com; spf=pass (mx1.freebsd.org: domain of dpchrist@holgerdanske.com designates 184.105.128.27 as permitted sender) smtp.mailfrom=dpchrist@holgerdanske.com X-Spamd-Result: default: False [-4.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[holgerdanske.com:s=nov-20210719-112354]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[holgerdanske.com:+]; DMARC_POLICY_ALLOW(-0.50)[holgerdanske.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:184.104.0.0/15, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 1/8/22 6:11 PM, Mel Pilgrim wrote: > I have a zpool with a "stripe of mirrors" structure: > > mech >   mirror-0 >     disk0 >     disk1 >   mirror-1 >     disk2 >     disk3 >   ... > > I want to convert it from mirrors to raidz as part of an upgrade, with > the final form looking something like this: > > mech >   raidz-0 >     disk20 >     disk21 >     ... > > I'd like to be able to attach the new raidz vdev as a mirror to the > entire pool, have it silver, then detach the old vdevs.  Is this at all > possible?  I'd rather not create a whole new pool and copy everything > over because doing so would require downtime. On 1/8/22 8:32 PM, Mel Pilgrim wrote: > On 2022-01-08 18:52, Paul Procacci wrote: >> Found an answer to this on facebook of all places ....... >> >> https://www.facebook.com/notes/unix-in-egypt/converting-zfs-2-way-mirror-to-a-raidz-array-wihtout-losing-data/10151919826687996/ >> >> >> >> My initial reaction was going to be 'no'....but after reading this, it >> does seem it is possible. >> I've never done it personally, but with proper backups .... why not? > > The degraded pool shenanigans described are to avoid needing separate > disks for the old and new structure, but that's exactly what I have, so > I can skip all of that. With those bits skipped, that becomes a regular > exercise of creating a new pool and streaming snapshots, which requires > downtime. It would help if you posted the actual disk sizes (disk0, disk1, disk2, disk3, etc., and disk20, disk21, disk22, etc.), drive slot quanities (total, used, and available), the current pool structure ('zpool status mech'), the raidz level you want (1, 2, or 3), and the desired pool structure. Assuming suitable drive quantities and sizes, spare drive slots, etc., I believe the following can be done without downtime (but performance will be impacted during evacuation/ copy): 1. Add drives disk20, disk21, etc., to pool "mech" as raidzN vdev's. For example: zpool add mech raidz1 disk20 disk21 disk22 zpool add mech raidz1 disk23 disk24 disk25 ... 2. Remove mirrors from the pool: zpool remove mech mirror-0 zpool remove mech mirror-1 ... Alternatively, interleave add's and remove's: zpool add mech raidz1 disk20 disk21 disk22 zpool remove mech mirror-0 zpool add mech raidz1 disk23 disk24 disk25 zpool remove mech mirror-X ... Verify "mirror-X" for the second and subsequent removals. Beware that FreeBSD 12.2-R man zpool(8) states that 'zpool remove' can remove mirrored top-level vdevs, but not raidz. So, if you botch adding a raidz vdev, you may need to wipe the pool, try again, and restore from backup. David