xref: /freebsd/sys/contrib/openzfs/man/man8/zpool-remove.8 (revision b197d4b893974c9eb4d7b38704c6d5c486235d6f)
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-level mirror for the
79same.
80Non-log devices or data devices that are part of a mirrored configuration can be removed using
81the
82.Nm zpool Cm detach
83command.
84.Bl -tag -width Ds
85.It Fl n
86Do not actually perform the removal
87.Pq Qq No-op .
88Instead, print the estimated amount of memory that will be used by the
89mapping table after the removal completes.
90This is nonzero only for top-level vdevs.
91.El
92.Bl -tag -width Ds
93.It Fl p
94Used in conjunction with the
95.Fl n
96flag, displays numbers as parsable (exact) values.
97.It Fl w
98Waits until the removal has completed before returning.
99.El
100.It Xo
101.Nm zpool
102.Cm remove
103.Fl s
104.Ar pool
105.Xc
106Stops and cancels an in-progress removal of a top-level vdev.
107.El
108.
109.Sh EXAMPLES
110.\" These are, respectively, examples 14 from zpool.8
111.\" Make sure to update them bidirectionally
112.Ss Example 1 : No Removing a Mirrored top-level (Log or Data) Device
113The following commands remove the mirrored log device
114.Sy mirror-2
115and mirrored top-level data device
116.Sy mirror-1 .
117.Pp
118Given this configuration:
119.Bd -literal -compact -offset Ds
120  pool: tank
121 state: ONLINE
122 scrub: none requested
123config:
124
125         NAME        STATE     READ WRITE CKSUM
126         tank        ONLINE       0     0     0
127           mirror-0  ONLINE       0     0     0
128             sda     ONLINE       0     0     0
129             sdb     ONLINE       0     0     0
130           mirror-1  ONLINE       0     0     0
131             sdc     ONLINE       0     0     0
132             sdd     ONLINE       0     0     0
133         logs
134           mirror-2  ONLINE       0     0     0
135             sde     ONLINE       0     0     0
136             sdf     ONLINE       0     0     0
137.Ed
138.Pp
139The command to remove the mirrored log
140.Ar mirror-2 No is:
141.Dl # Nm zpool Cm remove Ar tank mirror-2
142.Pp
143The command to remove the mirrored data
144.Ar mirror-1 No is:
145.Dl # Nm zpool Cm remove Ar tank mirror-1
146.
147.Sh SEE ALSO
148.Xr zpool-add 8 ,
149.Xr zpool-detach 8 ,
150.Xr zpool-labelclear 8 ,
151.Xr zpool-offline 8 ,
152.Xr zpool-replace 8 ,
153.Xr zpool-split 8
154