xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-remove.8 (revision bb2d13b686e3ccf6c3ccb36209dfb7dcc108b182)
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 March 16, 2022
30.Dt ZPOOL-REMOVE 8
31.Os
32.
33.Sh NAME
34.Nm zpool-remove
35.Nd remove devices from ZFS storage pool
36.
37.Sh SYNOPSIS
38.Nm zpool
39.Cm remove
40.Op Fl npw
41.Ar pool Ar device Ns …
42.Nm zpool
43.Cm remove
44.Fl s
45.Ar pool
46.
47.Sh DESCRIPTION
48.Bl -tag -width Ds
49.It Xo
50.Nm zpool
51.Cm remove
52.Op Fl npw
53.Ar pool Ar device Ns …
54.Xc
55Removes the specified device from the pool.
56This command supports removing hot spare, cache, log, and both mirrored and
57non-redundant primary top-level vdevs, including dedup and special vdevs.
58.Pp
59Top-level vdevs can only be removed if the primary pool storage does not contain
60a top-level raidz vdev, all top-level vdevs have the same sector size, and the
61keys for all encrypted datasets are loaded.
62.Pp
63Removing a top-level vdev reduces the total amount of space in the storage pool.
64The specified device will be evacuated by copying all allocated space from it to
65the other devices in the pool.
66In this case, the
67.Nm zpool Cm remove
68command initiates the removal and returns, while the evacuation continues in
69the background.
70The removal progress can be monitored with
71.Nm zpool Cm status .
72If an I/O error is encountered during the removal process it will be cancelled.
73The
74.Sy device_removal
75feature flag must be enabled to remove a top-level vdev, see
76.Xr zpool-features 7 .
77.Pp
78A mirrored top-level device (log or data) can be removed by specifying the top-
79level mirror for the
80same.
81Non-log devices or data devices that are part of a mirrored configuration can be
82removed using
83the
84.Nm zpool Cm detach
85command.
86.Bl -tag -width Ds
87.It Fl n
88Do not actually perform the removal
89.Pq Qq No-op .
90Instead, print the estimated amount of memory that will be used by the
91mapping table after the removal completes.
92This is nonzero only for top-level vdevs.
93.El
94.Bl -tag -width Ds
95.It Fl p
96Used in conjunction with the
97.Fl n
98flag, displays numbers as parsable (exact) values.
99.It Fl w
100Waits until the removal has completed before returning.
101.El
102.It Xo
103.Nm zpool
104.Cm remove
105.Fl s
106.Ar pool
107.Xc
108Stops and cancels an in-progress removal of a top-level vdev.
109.El
110.
111.Sh EXAMPLES
112.\" These are, respectively, examples 14 from zpool.8
113.\" Make sure to update them bidirectionally
114.Ss Example 1 : No Removing a Mirrored top-level (Log or Data) Device
115The following commands remove the mirrored log device
116.Sy mirror-2
117and mirrored top-level data device
118.Sy mirror-1 .
119.Pp
120Given this configuration:
121.Bd -literal -compact -offset Ds
122  pool: tank
123 state: ONLINE
124 scrub: none requested
125config:
126
127         NAME        STATE     READ WRITE CKSUM
128         tank        ONLINE       0     0     0
129           mirror-0  ONLINE       0     0     0
130             sda     ONLINE       0     0     0
131             sdb     ONLINE       0     0     0
132           mirror-1  ONLINE       0     0     0
133             sdc     ONLINE       0     0     0
134             sdd     ONLINE       0     0     0
135         logs
136           mirror-2  ONLINE       0     0     0
137             sde     ONLINE       0     0     0
138             sdf     ONLINE       0     0     0
139.Ed
140.Pp
141The command to remove the mirrored log
142.Ar mirror-2 No is :
143.Dl # Nm zpool Cm remove Ar tank mirror-2
144.Pp
145The command to remove the mirrored data
146.Ar mirror-1 No is :
147.Dl # Nm zpool Cm remove Ar tank mirror-1
148.
149.Sh SEE ALSO
150.Xr zpool-add 8 ,
151.Xr zpool-detach 8 ,
152.Xr zpool-labelclear 8 ,
153.Xr zpool-offline 8 ,
154.Xr zpool-replace 8 ,
155.Xr zpool-split 8
156