1.\"
2.\" CDDL HEADER START
3.\"
4.\" The contents of this file are subject to the terms of the
5.\" Common Development and Distribution License (the "License").
6.\" You may not use this file except in compliance with the License.
7.\"
8.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9.\" or https://opensource.org/licenses/CDDL-1.0.
10.\" See the License for the specific language governing permissions
11.\" and limitations under the License.
12.\"
13.\" When distributing Covered Code, include this CDDL HEADER in each
14.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15.\" If applicable, add the following below this CDDL HEADER, with the
16.\" fields enclosed by brackets "[]" replaced with your own identifying
17.\" information: Portions Copyright [yyyy] [name of copyright owner]
18.\"
19.\" CDDL HEADER END
20.\"
21.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
22.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
23.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
24.\" Copyright (c) 2017 Datto Inc.
25.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
26.\" Copyright 2017 Nexenta Systems, Inc.
27.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
28.\"
29.Dd May 29, 2021
30.Dt ZPOOL-REPLACE 8
31.Os
32.
33.Sh NAME
34.Nm zpool-replace
35.Nd replace one device with another in ZFS storage pool
36.Sh SYNOPSIS
37.Nm zpool
38.Cm replace
39.Op Fl fsw
40.Oo Fl o Ar property Ns = Ns Ar value Oc
41.Ar pool Ar device Op Ar new-device
42.
43.Sh DESCRIPTION
44Replaces
45.Ar device
46with
47.Ar new-device .
48This is equivalent to attaching
49.Ar new-device ,
50waiting for it to resilver, and then detaching
51.Ar device .
52Any in progress scrub will be cancelled.
53.Pp
54The size of
55.Ar new-device
56must be greater than or equal to the minimum size of all the devices in a mirror
57or raidz configuration.
58.Pp
59.Ar new-device
60is required if the pool is not redundant.
61If
62.Ar new-device
63is not specified, it defaults to
64.Ar device .
65This form of replacement is useful after an existing disk has failed and has
66been physically replaced.
67In this case, the new disk may have the same
68.Pa /dev
69path as the old device, even though it is actually a different disk.
70ZFS recognizes this.
71.Bl -tag -width Ds
72.It Fl f
73Forces use of
74.Ar new-device ,
75even if it appears to be in use.
76Not all devices can be overridden in this manner.
77.It Fl o Ar property Ns = Ns Ar value
78Sets the given pool properties.
79See the
80.Xr zpoolprops 7
81manual page for a list of valid properties that can be set.
82The only property supported at the moment is
83.Sy ashift .
84.It Fl s
85The
86.Ar new-device
87is reconstructed sequentially to restore redundancy as quickly as possible.
88Checksums are not verified during sequential reconstruction so a scrub is
89started when the resilver completes.
90Sequential reconstruction is not supported for raidz configurations.
91.It Fl w
92Waits until the replacement has completed before returning.
93.El
94.
95.Sh SEE ALSO
96.Xr zpool-detach 8 ,
97.Xr zpool-initialize 8 ,
98.Xr zpool-online 8 ,
99.Xr zpool-resilver 8
100