1eda14cbcSMatt Macy.\" 2eda14cbcSMatt Macy.\" CDDL HEADER START 3eda14cbcSMatt Macy.\" 4eda14cbcSMatt Macy.\" The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy.\" Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy.\" You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy.\" 8eda14cbcSMatt Macy.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9271171e0SMartin Matuska.\" or https://opensource.org/licenses/CDDL-1.0. 10eda14cbcSMatt Macy.\" See the License for the specific language governing permissions 11eda14cbcSMatt Macy.\" and limitations under the License. 12eda14cbcSMatt Macy.\" 13eda14cbcSMatt Macy.\" When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy.\" If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy.\" fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy.\" information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy.\" 19eda14cbcSMatt Macy.\" CDDL HEADER END 20eda14cbcSMatt Macy.\" 21eda14cbcSMatt Macy.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. 22eda14cbcSMatt Macy.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved. 23eda14cbcSMatt Macy.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved. 24eda14cbcSMatt Macy.\" Copyright (c) 2017 Datto Inc. 25eda14cbcSMatt Macy.\" Copyright (c) 2018 George Melikov. All Rights Reserved. 26eda14cbcSMatt Macy.\" Copyright 2017 Nexenta Systems, Inc. 27eda14cbcSMatt Macy.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved. 28eda14cbcSMatt Macy.\" 29*e716630dSMartin Matuska.Dd June 28, 2023 30eda14cbcSMatt Macy.Dt ZPOOL-ATTACH 8 31eda14cbcSMatt Macy.Os 3216038816SMartin Matuska. 33eda14cbcSMatt Macy.Sh NAME 347877fdebSMatt Macy.Nm zpool-attach 3516038816SMartin Matuska.Nd attach new device to existing ZFS vdev 36eda14cbcSMatt Macy.Sh SYNOPSIS 377877fdebSMatt Macy.Nm zpool 38eda14cbcSMatt Macy.Cm attach 39eda14cbcSMatt Macy.Op Fl fsw 40eda14cbcSMatt Macy.Oo Fl o Ar property Ns = Ns Ar value Oc 41eda14cbcSMatt Macy.Ar pool device new_device 4216038816SMartin Matuska. 43eda14cbcSMatt Macy.Sh DESCRIPTION 44eda14cbcSMatt MacyAttaches 45eda14cbcSMatt Macy.Ar new_device 46eda14cbcSMatt Macyto the existing 47eda14cbcSMatt Macy.Ar device . 48*e716630dSMartin MatuskaThe behavior differs depending on if the existing 49*e716630dSMartin Matuska.Ar device 50*e716630dSMartin Matuskais a RAID-Z device, or a mirror/plain device. 51*e716630dSMartin Matuska.Pp 52*e716630dSMartin MatuskaIf the existing device is a mirror or plain device 53*e716630dSMartin Matuska.Pq e.g. specified as Qo Li sda Qc or Qq Li mirror-7 , 54*e716630dSMartin Matuskathe new device will be mirrored with the existing device, a resilver will be 55*e716630dSMartin Matuskainitiated, and the new device will contribute to additional redundancy once the 56*e716630dSMartin Matuskaresilver completes. 57eda14cbcSMatt MacyIf 58eda14cbcSMatt Macy.Ar device 59eda14cbcSMatt Macyis not currently part of a mirrored configuration, 60eda14cbcSMatt Macy.Ar device 61eda14cbcSMatt Macyautomatically transforms into a two-way mirror of 62eda14cbcSMatt Macy.Ar device 63eda14cbcSMatt Macyand 64eda14cbcSMatt Macy.Ar new_device . 65eda14cbcSMatt MacyIf 66eda14cbcSMatt Macy.Ar device 67eda14cbcSMatt Macyis part of a two-way mirror, attaching 68eda14cbcSMatt Macy.Ar new_device 69eda14cbcSMatt Macycreates a three-way mirror, and so on. 70eda14cbcSMatt MacyIn either case, 71eda14cbcSMatt Macy.Ar new_device 72eda14cbcSMatt Macybegins to resilver immediately and any running scrub is cancelled. 73*e716630dSMartin Matuska.Pp 74*e716630dSMartin MatuskaIf the existing device is a RAID-Z device 75*e716630dSMartin Matuska.Pq e.g. specified as Qq Ar raidz2-0 , 76*e716630dSMartin Matuskathe new device will become part of that RAID-Z group. 77*e716630dSMartin MatuskaA "raidz expansion" will be initiated, and once the expansion completes, 78*e716630dSMartin Matuskathe new device will contribute additional space to the RAID-Z group. 79*e716630dSMartin MatuskaThe expansion entails reading all allocated space from existing disks in the 80*e716630dSMartin MatuskaRAID-Z group, and rewriting it to the new disks in the RAID-Z group (including 81*e716630dSMartin Matuskathe newly added 82*e716630dSMartin Matuska.Ar device ) . 83*e716630dSMartin MatuskaIts progress can be monitored with 84*e716630dSMartin Matuska.Nm zpool Cm status . 85*e716630dSMartin Matuska.Pp 86*e716630dSMartin MatuskaData redundancy is maintained during and after the expansion. 87*e716630dSMartin MatuskaIf a disk fails while the expansion is in progress, the expansion pauses until 88*e716630dSMartin Matuskathe health of the RAID-Z vdev is restored (e.g. by replacing the failed disk 89*e716630dSMartin Matuskaand waiting for reconstruction to complete). 90*e716630dSMartin MatuskaExpansion does not change the number of failures that can be tolerated 91*e716630dSMartin Matuskawithout data loss (e.g. a RAID-Z2 is still a RAID-Z2 even after expansion). 92*e716630dSMartin MatuskaA RAID-Z vdev can be expanded multiple times. 93*e716630dSMartin Matuska.Pp 94*e716630dSMartin MatuskaAfter the expansion completes, old blocks retain their old data-to-parity 95*e716630dSMartin Matuskaratio 96*e716630dSMartin Matuska.Pq e.g. 5-wide RAID-Z2 has 3 data and 2 parity 97*e716630dSMartin Matuskabut distributed among the larger set of disks. 98*e716630dSMartin MatuskaNew blocks will be written with the new data-to-parity ratio (e.g. a 5-wide 99*e716630dSMartin MatuskaRAID-Z2 which has been expanded once to 6-wide, has 4 data and 2 parity). 100*e716630dSMartin MatuskaHowever, the vdev's assumed parity ratio does not change, so slightly less 101*e716630dSMartin Matuskaspace than is expected may be reported for newly-written blocks, according to 102*e716630dSMartin Matuska.Nm zfs Cm list , 103*e716630dSMartin Matuska.Nm df , 104*e716630dSMartin Matuska.Nm ls Fl s , 105*e716630dSMartin Matuskaand similar tools. 106*e716630dSMartin Matuska.Pp 107*e716630dSMartin MatuskaA pool-wide scrub is initiated at the end of the expansion in order to verify 108*e716630dSMartin Matuskathe checksums of all blocks which have been copied during the expansion. 109eda14cbcSMatt Macy.Bl -tag -width Ds 110eda14cbcSMatt Macy.It Fl f 111eda14cbcSMatt MacyForces use of 112eda14cbcSMatt Macy.Ar new_device , 113eda14cbcSMatt Macyeven if it appears to be in use. 114eda14cbcSMatt MacyNot all devices can be overridden in this manner. 115eda14cbcSMatt Macy.It Fl o Ar property Ns = Ns Ar value 11616038816SMartin MatuskaSets the given pool properties. 11716038816SMartin MatuskaSee the 1183ff01b23SMartin Matuska.Xr zpoolprops 7 11916038816SMartin Matuskamanual page for a list of valid properties that can be set. 12016038816SMartin MatuskaThe only property supported at the moment is 12116038816SMartin Matuska.Sy ashift . 122eda14cbcSMatt Macy.It Fl s 123*e716630dSMartin MatuskaWhen attaching to a mirror or plain device, the 124eda14cbcSMatt Macy.Ar new_device 125eda14cbcSMatt Macyis reconstructed sequentially to restore redundancy as quickly as possible. 126e92ffd9bSMartin MatuskaChecksums are not verified during sequential reconstruction so a scrub is 127eda14cbcSMatt Macystarted when the resilver completes. 128eda14cbcSMatt Macy.It Fl w 129eda14cbcSMatt MacyWaits until 130eda14cbcSMatt Macy.Ar new_device 131*e716630dSMartin Matuskahas finished resilvering or expanding before returning. 132eda14cbcSMatt Macy.El 13316038816SMartin Matuska. 134eda14cbcSMatt Macy.Sh SEE ALSO 135eda14cbcSMatt Macy.Xr zpool-add 8 , 13616038816SMartin Matuska.Xr zpool-detach 8 , 137eda14cbcSMatt Macy.Xr zpool-import 8 , 138eda14cbcSMatt Macy.Xr zpool-initialize 8 , 139eda14cbcSMatt Macy.Xr zpool-online 8 , 140eda14cbcSMatt Macy.Xr zpool-replace 8 , 141eda14cbcSMatt Macy.Xr zpool-resilver 8 142