Re: Can I add a raidz vdev as a mirror of existing vdevs
- In reply to: David Christensen : "Re: Can I add a raidz vdev as a mirror of existing vdevs"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 09 Jan 2022 21:43:32 UTC
On 1/9/22 1:28 AM, David Christensen wrote:
> 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/
>
> >>
> <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
That is better written:
zpool remove mech mirror-0 mirror-1 ...
Or, apply the mirror-X comment; below.
> 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
>