xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-remove.8 (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1.\" SPDX-License-Identifier: CDDL-1.0
2.\"
3.\" CDDL HEADER START
4.\"
5.\" The contents of this file are subject to the terms of the
6.\" Common Development and Distribution License (the "License").
7.\" You may not use this file except in compliance with the License.
8.\"
9.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10.\" or https://opensource.org/licenses/CDDL-1.0.
11.\" See the License for the specific language governing permissions
12.\" and limitations under the License.
13.\"
14.\" When distributing Covered Code, include this CDDL HEADER in each
15.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16.\" If applicable, add the following below this CDDL HEADER, with the
17.\" fields enclosed by brackets "[]" replaced with your own identifying
18.\" information: Portions Copyright [yyyy] [name of copyright owner]
19.\"
20.\" CDDL HEADER END
21.\"
22.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
23.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
24.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
25.\" Copyright (c) 2017 Datto Inc.
26.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
27.\" Copyright 2017 Nexenta Systems, Inc.
28.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
29.\"
30.Dd March 16, 2022
31.Dt ZPOOL-REMOVE 8
32.Os
33.
34.Sh NAME
35.Nm zpool-remove
36.Nd remove devices from ZFS storage pool
37.
38.Sh SYNOPSIS
39.Nm zpool
40.Cm remove
41.Op Fl npw
42.Ar pool Ar device Ns …
43.Nm zpool
44.Cm remove
45.Fl s
46.Ar pool
47.
48.Sh DESCRIPTION
49.Bl -tag -width Ds
50.It Xo
51.Nm zpool
52.Cm remove
53.Op Fl npw
54.Ar pool Ar device Ns …
55.Xc
56Removes the specified device from the pool.
57This command supports removing hot spare, cache, log, and both mirrored and
58non-redundant primary top-level vdevs, including dedup and special vdevs.
59.Pp
60Top-level vdevs can only be removed if the primary pool storage does not contain
61a top-level raidz vdev, all top-level vdevs have the same sector size, and the
62keys for all encrypted datasets are loaded.
63.Pp
64Removing a top-level vdev reduces the total amount of space in the storage pool.
65The specified device will be evacuated by copying all allocated space from it to
66the other devices in the pool.
67In this case, the
68.Nm zpool Cm remove
69command initiates the removal and returns, while the evacuation continues in
70the background.
71The removal progress can be monitored with
72.Nm zpool Cm status .
73If an I/O error is encountered during the removal process it will be canceled.
74The
75.Sy device_removal
76feature flag must be enabled to remove a top-level vdev, see
77.Xr zpool-features 7 .
78.Pp
79A mirrored top-level device (log or data) can be removed by specifying the top-
80level mirror for the
81same.
82Non-log devices or data devices that are part of a mirrored configuration can be
83removed using
84the
85.Nm zpool Cm detach
86command.
87.Bl -tag -width Ds
88.It Fl n
89Do not actually perform the removal
90.Pq Qq No-op .
91Instead, print the estimated amount of memory that will be used by the
92mapping table after the removal completes.
93This is nonzero only for top-level vdevs.
94.El
95.Bl -tag -width Ds
96.It Fl p
97Used in conjunction with the
98.Fl n
99flag, displays numbers as parsable (exact) values.
100.It Fl w
101Waits until the removal has completed before returning.
102.El
103.It Xo
104.Nm zpool
105.Cm remove
106.Fl s
107.Ar pool
108.Xc
109Stops and cancels an in-progress removal of a top-level vdev.
110.El
111.
112.Sh EXAMPLES
113.\" These are, respectively, examples 15 from zpool.8
114.\" Make sure to update them bidirectionally
115.Ss Example 1 : No Removing a Mirrored top-level (Log or Data) Device
116The following commands remove the mirrored log device
117.Sy mirror-2
118and mirrored top-level data device
119.Sy mirror-1 .
120.Pp
121Given this configuration:
122.Bd -literal -compact -offset Ds
123  pool: tank
124 state: ONLINE
125 scrub: none requested
126config:
127
128         NAME        STATE     READ WRITE CKSUM
129         tank        ONLINE       0     0     0
130           mirror-0  ONLINE       0     0     0
131             sda     ONLINE       0     0     0
132             sdb     ONLINE       0     0     0
133           mirror-1  ONLINE       0     0     0
134             sdc     ONLINE       0     0     0
135             sdd     ONLINE       0     0     0
136         logs
137           mirror-2  ONLINE       0     0     0
138             sde     ONLINE       0     0     0
139             sdf     ONLINE       0     0     0
140.Ed
141.Pp
142The command to remove the mirrored log
143.Ar mirror-2 No is :
144.Dl # Nm zpool Cm remove Ar tank mirror-2
145.Pp
146At this point, the log device no longer exists
147(both sides of the mirror have been removed):
148.Bd -literal -compact -offset Ds
149  pool: tank
150 state: ONLINE
151  scan: none requested
152config:
153
154        NAME        STATE     READ WRITE CKSUM
155        tank        ONLINE       0     0     0
156          mirror-0  ONLINE       0     0     0
157            sda     ONLINE       0     0     0
158            sdb     ONLINE       0     0     0
159          mirror-1  ONLINE       0     0     0
160            sdc     ONLINE       0     0     0
161            sdd     ONLINE       0     0     0
162.Ed
163.Pp
164The command to remove the mirrored data
165.Ar mirror-1 No is :
166.Dl # Nm zpool Cm remove Ar tank mirror-1
167.Pp
168After
169.Ar mirror-1 No has been evacuated, the pool remains redundant, but
170the total amount of space is reduced:
171.Bd -literal -compact -offset Ds
172  pool: tank
173 state: ONLINE
174  scan: none requested
175config:
176
177        NAME        STATE     READ WRITE CKSUM
178        tank        ONLINE       0     0     0
179          mirror-0  ONLINE       0     0     0
180            sda     ONLINE       0     0     0
181            sdb     ONLINE       0     0     0
182.Ed
183.
184.Sh SEE ALSO
185.Xr zpool-add 8 ,
186.Xr zpool-detach 8 ,
187.Xr zpool-labelclear 8 ,
188.Xr zpool-offline 8 ,
189.Xr zpool-replace 8 ,
190.Xr zpool-split 8
191