xref: /freebsd-src/sys/contrib/openzfs/man/man8/zpool.8 (revision 718519f4efc71096422fc71dab90b2a3369871ff)
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.\"
29ce4dcb97SMartin Matuska.Dd February 14, 2024
30eda14cbcSMatt Macy.Dt ZPOOL 8
31eda14cbcSMatt Macy.Os
3216038816SMartin Matuska.
33eda14cbcSMatt Macy.Sh NAME
34eda14cbcSMatt Macy.Nm zpool
35eda14cbcSMatt Macy.Nd configure ZFS storage pools
36eda14cbcSMatt Macy.Sh SYNOPSIS
37eda14cbcSMatt Macy.Nm
38eda14cbcSMatt Macy.Fl ?V
39eda14cbcSMatt Macy.Nm
40eda14cbcSMatt Macy.Cm version
41ce4dcb97SMartin Matuska.Op Fl j
42eda14cbcSMatt Macy.Nm
4316038816SMartin Matuska.Cm subcommand
44681ce946SMartin Matuska.Op Ar arguments
4516038816SMartin Matuska.
46eda14cbcSMatt Macy.Sh DESCRIPTION
47eda14cbcSMatt MacyThe
48eda14cbcSMatt Macy.Nm
49eda14cbcSMatt Macycommand configures ZFS storage pools.
50eda14cbcSMatt MacyA storage pool is a collection of devices that provides physical storage and
51eda14cbcSMatt Macydata replication for ZFS datasets.
52eda14cbcSMatt MacyAll datasets within a storage pool share the same space.
53eda14cbcSMatt MacySee
54eda14cbcSMatt Macy.Xr zfs 8
55eda14cbcSMatt Macyfor information on managing datasets.
56eda14cbcSMatt Macy.Pp
57eda14cbcSMatt MacyFor an overview of creating and managing ZFS storage pools see the
583ff01b23SMartin Matuska.Xr zpoolconcepts 7
59eda14cbcSMatt Macymanual page.
6016038816SMartin Matuska.
61eda14cbcSMatt Macy.Sh SUBCOMMANDS
62eda14cbcSMatt MacyAll subcommands that modify state are logged persistently to the pool in their
63eda14cbcSMatt Macyoriginal form.
64eda14cbcSMatt Macy.Pp
65eda14cbcSMatt MacyThe
66eda14cbcSMatt Macy.Nm
67eda14cbcSMatt Macycommand provides subcommands to create and destroy storage pools, add capacity
68eda14cbcSMatt Macyto storage pools, and provide information about the storage pools.
69eda14cbcSMatt MacyThe following subcommands are supported:
70eda14cbcSMatt Macy.Bl -tag -width Ds
71eda14cbcSMatt Macy.It Xo
72eda14cbcSMatt Macy.Nm
7316038816SMartin Matuska.Fl ?\&
74eda14cbcSMatt Macy.Xc
75eda14cbcSMatt MacyDisplays a help message.
76eda14cbcSMatt Macy.It Xo
77eda14cbcSMatt Macy.Nm
78eda14cbcSMatt Macy.Fl V , -version
79eda14cbcSMatt Macy.Xc
80eda14cbcSMatt Macy.It Xo
81eda14cbcSMatt Macy.Nm
82eda14cbcSMatt Macy.Cm version
83ce4dcb97SMartin Matuska.Op Fl j
84eda14cbcSMatt Macy.Xc
85eda14cbcSMatt MacyDisplays the software version of the
86eda14cbcSMatt Macy.Nm
8716038816SMartin Matuskauserland utility and the ZFS kernel module.
88ce4dcb97SMartin MatuskaUse
89ce4dcb97SMartin Matuska.Fl j
90ce4dcb97SMartin Matuskaoption to output in JSON format.
91eda14cbcSMatt Macy.El
9216038816SMartin Matuska.
93eda14cbcSMatt Macy.Ss Creation
94eda14cbcSMatt Macy.Bl -tag -width Ds
95eda14cbcSMatt Macy.It Xr zpool-create 8
96eda14cbcSMatt MacyCreates a new storage pool containing the virtual devices specified on the
97eda14cbcSMatt Macycommand line.
98eda14cbcSMatt Macy.It Xr zpool-initialize 8
99eda14cbcSMatt MacyBegins initializing by writing to all unallocated regions on the specified
100eda14cbcSMatt Macydevices, or all eligible devices in the pool if no individual devices are
101eda14cbcSMatt Macyspecified.
102eda14cbcSMatt Macy.El
10316038816SMartin Matuska.
104eda14cbcSMatt Macy.Ss Destruction
105eda14cbcSMatt Macy.Bl -tag -width Ds
106eda14cbcSMatt Macy.It Xr zpool-destroy 8
107eda14cbcSMatt MacyDestroys the given pool, freeing up any devices for other use.
108eda14cbcSMatt Macy.It Xr zpool-labelclear 8
109eda14cbcSMatt MacyRemoves ZFS label information from the specified
110eda14cbcSMatt Macy.Ar device .
111eda14cbcSMatt Macy.El
11216038816SMartin Matuska.
113eda14cbcSMatt Macy.Ss Virtual Devices
114eda14cbcSMatt Macy.Bl -tag -width Ds
115eda14cbcSMatt Macy.It Xo
11616038816SMartin Matuska.Xr zpool-attach 8 Ns / Ns Xr zpool-detach 8
117eda14cbcSMatt Macy.Xc
1182ad756a6SMartin MatuskaConverts a non-redundant disk into a mirror, or increases
1192ad756a6SMartin Matuskathe redundancy level of an existing mirror
1202ad756a6SMartin Matuska.Cm ( attach Ns ), or performs the inverse operation (
1212ad756a6SMartin Matuska.Cm detach Ns ).
122eda14cbcSMatt Macy.It Xo
12316038816SMartin Matuska.Xr zpool-add 8 Ns / Ns Xr zpool-remove 8
124eda14cbcSMatt Macy.Xc
125eda14cbcSMatt MacyAdds the specified virtual devices to the given pool,
126eda14cbcSMatt Macyor removes the specified device from the pool.
127eda14cbcSMatt Macy.It Xr zpool-replace 8
128eda14cbcSMatt MacyReplaces an existing device (which may be faulted) with a new one.
129eda14cbcSMatt Macy.It Xr zpool-split 8
130bb2d13b6SMartin MatuskaCreates a new pool by splitting all mirrors in an existing pool (which decreases
131bb2d13b6SMartin Matuskaits redundancy).
132eda14cbcSMatt Macy.El
13316038816SMartin Matuska.
134eda14cbcSMatt Macy.Ss Properties
135eda14cbcSMatt MacyAvailable pool properties listed in the
1363ff01b23SMartin Matuska.Xr zpoolprops 7
137eda14cbcSMatt Macymanual page.
138eda14cbcSMatt Macy.Bl -tag -width Ds
139eda14cbcSMatt Macy.It Xr zpool-list 8
140eda14cbcSMatt MacyLists the given pools along with a health status and space usage.
141eda14cbcSMatt Macy.It Xo
14216038816SMartin Matuska.Xr zpool-get 8 Ns / Ns Xr zpool-set 8
143eda14cbcSMatt Macy.Xc
144eda14cbcSMatt MacyRetrieves the given list of properties
145eda14cbcSMatt Macy.Po
146eda14cbcSMatt Macyor all properties if
147eda14cbcSMatt Macy.Sy all
148eda14cbcSMatt Macyis used
149eda14cbcSMatt Macy.Pc
150eda14cbcSMatt Macyfor the specified storage pool(s).
151eda14cbcSMatt Macy.El
15216038816SMartin Matuska.
153eda14cbcSMatt Macy.Ss Monitoring
154eda14cbcSMatt Macy.Bl -tag -width Ds
155eda14cbcSMatt Macy.It Xr zpool-status 8
156eda14cbcSMatt MacyDisplays the detailed health status for the given pools.
157eda14cbcSMatt Macy.It Xr zpool-iostat 8
158c03c5b1cSMartin MatuskaDisplays logical I/O statistics for the given pools/vdevs.
159c03c5b1cSMartin MatuskaPhysical I/O operations may be observed via
160eda14cbcSMatt Macy.Xr iostat 1 .
161eda14cbcSMatt Macy.It Xr zpool-events 8
16216038816SMartin MatuskaLists all recent events generated by the ZFS kernel modules.
16316038816SMartin MatuskaThese events are consumed by the
164eda14cbcSMatt Macy.Xr zed 8
165eda14cbcSMatt Macyand used to automate administrative tasks such as replacing a failed device
16616038816SMartin Matuskawith a hot spare.
1673ff01b23SMartin MatuskaThat manual page also describes the subclasses and event payloads
1683ff01b23SMartin Matuskathat can be generated.
169eda14cbcSMatt Macy.It Xr zpool-history 8
170eda14cbcSMatt MacyDisplays the command history of the specified pool(s) or all pools if no pool is
171eda14cbcSMatt Macyspecified.
172eda14cbcSMatt Macy.El
17316038816SMartin Matuska.
174eda14cbcSMatt Macy.Ss Maintenance
175eda14cbcSMatt Macy.Bl -tag -width Ds
176ce4dcb97SMartin Matuska.It Xr zpool-prefetch 8
177ce4dcb97SMartin MatuskaPrefetches specific types of pool data.
178eda14cbcSMatt Macy.It Xr zpool-scrub 8
179eda14cbcSMatt MacyBegins a scrub or resumes a paused scrub.
180eda14cbcSMatt Macy.It Xr zpool-checkpoint 8
181eda14cbcSMatt MacyCheckpoints the current state of
18216038816SMartin Matuska.Ar pool ,
18316038816SMartin Matuskawhich can be later restored by
18416038816SMartin Matuska.Nm zpool Cm import Fl -rewind-to-checkpoint .
185eda14cbcSMatt Macy.It Xr zpool-trim 8
186bb2d13b6SMartin MatuskaInitiates an immediate on-demand TRIM operation for all of the free space in a
187bb2d13b6SMartin Matuskapool.
18816038816SMartin MatuskaThis operation informs the underlying storage devices of all blocks
189eda14cbcSMatt Macyin the pool which are no longer allocated and allows thinly provisioned
190eda14cbcSMatt Macydevices to reclaim the space.
191eda14cbcSMatt Macy.It Xr zpool-sync 8
192eda14cbcSMatt MacyThis command forces all in-core dirty data to be written to the primary
19316038816SMartin Matuskapool storage and not the ZIL.
19416038816SMartin MatuskaIt will also update administrative information including quota reporting.
19516038816SMartin MatuskaWithout arguments,
19616038816SMartin Matuska.Nm zpool Cm sync
19716038816SMartin Matuskawill sync all pools on the system.
19816038816SMartin MatuskaOtherwise, it will sync only the specified pool(s).
199eda14cbcSMatt Macy.It Xr zpool-upgrade 8
200eda14cbcSMatt MacyManage the on-disk format version of storage pools.
201eda14cbcSMatt Macy.It Xr zpool-wait 8
202eda14cbcSMatt MacyWaits until all background activity of the given types has ceased in the given
203eda14cbcSMatt Macypool.
204eda14cbcSMatt Macy.El
20516038816SMartin Matuska.
206eda14cbcSMatt Macy.Ss Fault Resolution
207eda14cbcSMatt Macy.Bl -tag -width Ds
208eda14cbcSMatt Macy.It Xo
20916038816SMartin Matuska.Xr zpool-offline 8 Ns / Ns Xr zpool-online 8
210eda14cbcSMatt Macy.Xc
211eda14cbcSMatt MacyTakes the specified physical device offline or brings it online.
212eda14cbcSMatt Macy.It Xr zpool-resilver 8
21316038816SMartin MatuskaStarts a resilver.
214bb2d13b6SMartin MatuskaIf an existing resilver is already running it will be restarted from the
215bb2d13b6SMartin Matuskabeginning.
216eda14cbcSMatt Macy.It Xr zpool-reopen 8
217eda14cbcSMatt MacyReopen all the vdevs associated with the pool.
218eda14cbcSMatt Macy.It Xr zpool-clear 8
219eda14cbcSMatt MacyClears device errors in a pool.
220eda14cbcSMatt Macy.El
22116038816SMartin Matuska.
222eda14cbcSMatt Macy.Ss Import & Export
223eda14cbcSMatt Macy.Bl -tag -width Ds
224eda14cbcSMatt Macy.It Xr zpool-import 8
225eda14cbcSMatt MacyMake disks containing ZFS storage pools available for use on the system.
226eda14cbcSMatt Macy.It Xr zpool-export 8
227eda14cbcSMatt MacyExports the given pools from the system.
228eda14cbcSMatt Macy.It Xr zpool-reguid 8
229eda14cbcSMatt MacyGenerates a new unique identifier for the pool.
230eda14cbcSMatt Macy.El
23116038816SMartin Matuska.
232eda14cbcSMatt Macy.Sh EXIT STATUS
233eda14cbcSMatt MacyThe following exit values are returned:
23416038816SMartin Matuska.Bl -tag -compact -offset 4n -width "a"
235eda14cbcSMatt Macy.It Sy 0
236eda14cbcSMatt MacySuccessful completion.
237eda14cbcSMatt Macy.It Sy 1
238eda14cbcSMatt MacyAn error occurred.
239eda14cbcSMatt Macy.It Sy 2
240eda14cbcSMatt MacyInvalid command line options were specified.
241eda14cbcSMatt Macy.El
24216038816SMartin Matuska.
243eda14cbcSMatt Macy.Sh EXAMPLES
2442ad756a6SMartin Matuska.\" Examples 1, 2, 3, 4, 12, 13 are shared with zpool-create.8.
2452ad756a6SMartin Matuska.\" Examples 6, 14 are shared with zpool-add.8.
2462ad756a6SMartin Matuska.\" Examples 7, 16 are shared with zpool-list.8.
2472ad756a6SMartin Matuska.\" Examples 8 are shared with zpool-destroy.8.
2482ad756a6SMartin Matuska.\" Examples 9 are shared with zpool-export.8.
2492ad756a6SMartin Matuska.\" Examples 10 are shared with zpool-import.8.
2502ad756a6SMartin Matuska.\" Examples 11 are shared with zpool-upgrade.8.
2512ad756a6SMartin Matuska.\" Examples 15 are shared with zpool-remove.8.
2522ad756a6SMartin Matuska.\" Examples 17 are shared with zpool-status.8.
2532ad756a6SMartin Matuska.\" Examples 14, 17 are also shared with zpool-iostat.8.
254da5137abSMartin Matuska.\" Make sure to update them omnidirectionally
255da5137abSMartin Matuska.Ss Example 1 : No Creating a RAID-Z Storage Pool
256eda14cbcSMatt MacyThe following command creates a pool with a single raidz root vdev that
25716038816SMartin Matuskaconsists of six disks:
258da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy raidz Pa sda sdb sdc sdd sde sdf
25916038816SMartin Matuska.
260da5137abSMartin Matuska.Ss Example 2 : No Creating a Mirrored Storage Pool
261eda14cbcSMatt MacyThe following command creates a pool with two mirrors, where each mirror
26216038816SMartin Matuskacontains two disks:
263da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy mirror Pa sdc sdd
26416038816SMartin Matuska.
265da5137abSMartin Matuska.Ss Example 3 : No Creating a ZFS Storage Pool by Using Partitions
266da5137abSMartin MatuskaThe following command creates a non-redundant pool using two disk partitions:
267da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Pa sda1 sdb2
26816038816SMartin Matuska.
269da5137abSMartin Matuska.Ss Example 4 : No Creating a ZFS Storage Pool by Using Files
270da5137abSMartin MatuskaThe following command creates a non-redundant pool using files.
271eda14cbcSMatt MacyWhile not recommended, a pool based on files can be useful for experimental
272eda14cbcSMatt Macypurposes.
273da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Pa /path/to/file/a /path/to/file/b
27416038816SMartin Matuska.
2752ad756a6SMartin Matuska.Ss Example 5 : No Making a non-mirrored ZFS Storage Pool mirrored
2762ad756a6SMartin MatuskaThe following command converts an existing single device
2772ad756a6SMartin Matuska.Ar sda
2782ad756a6SMartin Matuskainto a mirror by attaching a second device to it,
2792ad756a6SMartin Matuska.Ar sdb .
2802ad756a6SMartin Matuska.Dl # Nm zpool Cm attach Ar tank Pa sda sdb
2812ad756a6SMartin Matuska.
2822ad756a6SMartin Matuska.Ss Example 6 : No Adding a Mirror to a ZFS Storage Pool
283eda14cbcSMatt MacyThe following command adds two mirrored disks to the pool
28416038816SMartin Matuska.Ar tank ,
285eda14cbcSMatt Macyassuming the pool is already made up of two-way mirrors.
286eda14cbcSMatt MacyThe additional space is immediately available to any datasets within the pool.
287da5137abSMartin Matuska.Dl # Nm zpool Cm add Ar tank Sy mirror Pa sda sdb
28816038816SMartin Matuska.
2892ad756a6SMartin Matuska.Ss Example 7 : No Listing Available ZFS Storage Pools
290eda14cbcSMatt MacyThe following command lists all available pools on the system.
291eda14cbcSMatt MacyIn this case, the pool
29216038816SMartin Matuska.Ar zion
293eda14cbcSMatt Macyis faulted due to a missing device.
294eda14cbcSMatt MacyThe results from this command are similar to the following:
29516038816SMartin Matuska.Bd -literal -compact -offset Ds
29616038816SMartin Matuska.No # Nm zpool Cm list
297eda14cbcSMatt MacyNAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
298eda14cbcSMatt Macyrpool  19.9G  8.43G  11.4G         -    33%    42%  1.00x  ONLINE  -
299eda14cbcSMatt Macytank   61.5G  20.0G  41.5G         -    48%    32%  1.00x  ONLINE  -
300eda14cbcSMatt Macyzion       -      -      -         -      -      -      -  FAULTED -
301eda14cbcSMatt Macy.Ed
30216038816SMartin Matuska.
3032ad756a6SMartin Matuska.Ss Example 8 : No Destroying a ZFS Storage Pool
304eda14cbcSMatt MacyThe following command destroys the pool
30516038816SMartin Matuska.Ar tank
30616038816SMartin Matuskaand any datasets contained within:
30716038816SMartin Matuska.Dl # Nm zpool Cm destroy Fl f Ar tank
30816038816SMartin Matuska.
3092ad756a6SMartin Matuska.Ss Example 9 : No Exporting a ZFS Storage Pool
310eda14cbcSMatt MacyThe following command exports the devices in pool
31116038816SMartin Matuska.Ar tank
31216038816SMartin Matuskaso that they can be relocated or later imported:
31316038816SMartin Matuska.Dl # Nm zpool Cm export Ar tank
31416038816SMartin Matuska.
3152ad756a6SMartin Matuska.Ss Example 10 : No Importing a ZFS Storage Pool
316eda14cbcSMatt MacyThe following command displays available pools, and then imports the pool
31716038816SMartin Matuska.Ar tank
318eda14cbcSMatt Macyfor use on the system.
319eda14cbcSMatt MacyThe results from this command are similar to the following:
32016038816SMartin Matuska.Bd -literal -compact -offset Ds
32116038816SMartin Matuska.No # Nm zpool Cm import
322eda14cbcSMatt Macy  pool: tank
323eda14cbcSMatt Macy    id: 15451357997522795478
324eda14cbcSMatt Macy state: ONLINE
325eda14cbcSMatt Macyaction: The pool can be imported using its name or numeric identifier.
326eda14cbcSMatt Macyconfig:
327eda14cbcSMatt Macy
328eda14cbcSMatt Macy        tank        ONLINE
329eda14cbcSMatt Macy          mirror    ONLINE
330eda14cbcSMatt Macy            sda     ONLINE
331eda14cbcSMatt Macy            sdb     ONLINE
332eda14cbcSMatt Macy
33316038816SMartin Matuska.No # Nm zpool Cm import Ar tank
334eda14cbcSMatt Macy.Ed
33516038816SMartin Matuska.
3362ad756a6SMartin Matuska.Ss Example 11 : No Upgrading All ZFS Storage Pools to the Current Version
337eda14cbcSMatt MacyThe following command upgrades all ZFS Storage pools to the current version of
33816038816SMartin Matuskathe software:
33916038816SMartin Matuska.Bd -literal -compact -offset Ds
34016038816SMartin Matuska.No # Nm zpool Cm upgrade Fl a
341eda14cbcSMatt MacyThis system is currently running ZFS version 2.
342eda14cbcSMatt Macy.Ed
34316038816SMartin Matuska.
3442ad756a6SMartin Matuska.Ss Example 12 : No Managing Hot Spares
345eda14cbcSMatt MacyThe following command creates a new pool with an available hot spare:
346da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar tank Sy mirror Pa sda sdb Sy spare Pa sdc
347eda14cbcSMatt Macy.Pp
348eda14cbcSMatt MacyIf one of the disks were to fail, the pool would be reduced to the degraded
349eda14cbcSMatt Macystate.
350eda14cbcSMatt MacyThe failed device can be replaced using the following command:
351da5137abSMartin Matuska.Dl # Nm zpool Cm replace Ar tank Pa sda sdd
352eda14cbcSMatt Macy.Pp
353eda14cbcSMatt MacyOnce the data has been resilvered, the spare is automatically removed and is
354eda14cbcSMatt Macymade available for use should another device fail.
355eda14cbcSMatt MacyThe hot spare can be permanently removed from the pool using the following
356eda14cbcSMatt Macycommand:
357da5137abSMartin Matuska.Dl # Nm zpool Cm remove Ar tank Pa sdc
35816038816SMartin Matuska.
3592ad756a6SMartin Matuska.Ss Example 13 : No Creating a ZFS Pool with Mirrored Separate Intent Logs
360eda14cbcSMatt MacyThe following command creates a ZFS storage pool consisting of two, two-way
361eda14cbcSMatt Macymirrors and mirrored log devices:
362da5137abSMartin Matuska.Dl # Nm zpool Cm create Ar pool Sy mirror Pa sda sdb Sy mirror Pa sdc sdd Sy log mirror Pa sde sdf
36316038816SMartin Matuska.
3642ad756a6SMartin Matuska.Ss Example 14 : No Adding Cache Devices to a ZFS Pool
365eda14cbcSMatt MacyThe following command adds two disks for use as cache devices to a ZFS storage
366eda14cbcSMatt Macypool:
367da5137abSMartin Matuska.Dl # Nm zpool Cm add Ar pool Sy cache Pa sdc sdd
368eda14cbcSMatt Macy.Pp
369eda14cbcSMatt MacyOnce added, the cache devices gradually fill with content from main memory.
370eda14cbcSMatt MacyDepending on the size of your cache devices, it could take over an hour for
371eda14cbcSMatt Macythem to fill.
372eda14cbcSMatt MacyCapacity and reads can be monitored using the
373eda14cbcSMatt Macy.Cm iostat
37416038816SMartin Matuskasubcommand as follows:
37516038816SMartin Matuska.Dl # Nm zpool Cm iostat Fl v Ar pool 5
37616038816SMartin Matuska.
3772ad756a6SMartin Matuska.Ss Example 15 : No Removing a Mirrored top-level (Log or Data) Device
378eda14cbcSMatt MacyThe following commands remove the mirrored log device
379eda14cbcSMatt Macy.Sy mirror-2
380eda14cbcSMatt Macyand mirrored top-level data device
381eda14cbcSMatt Macy.Sy mirror-1 .
382eda14cbcSMatt Macy.Pp
383eda14cbcSMatt MacyGiven this configuration:
38416038816SMartin Matuska.Bd -literal -compact -offset Ds
385eda14cbcSMatt Macy  pool: tank
386eda14cbcSMatt Macy state: ONLINE
387eda14cbcSMatt Macy scrub: none requested
388eda14cbcSMatt Macyconfig:
389eda14cbcSMatt Macy
390eda14cbcSMatt Macy         NAME        STATE     READ WRITE CKSUM
391eda14cbcSMatt Macy         tank        ONLINE       0     0     0
392eda14cbcSMatt Macy           mirror-0  ONLINE       0     0     0
393eda14cbcSMatt Macy             sda     ONLINE       0     0     0
394eda14cbcSMatt Macy             sdb     ONLINE       0     0     0
395eda14cbcSMatt Macy           mirror-1  ONLINE       0     0     0
396eda14cbcSMatt Macy             sdc     ONLINE       0     0     0
397eda14cbcSMatt Macy             sdd     ONLINE       0     0     0
398eda14cbcSMatt Macy         logs
399eda14cbcSMatt Macy           mirror-2  ONLINE       0     0     0
400eda14cbcSMatt Macy             sde     ONLINE       0     0     0
401eda14cbcSMatt Macy             sdf     ONLINE       0     0     0
402eda14cbcSMatt Macy.Ed
403eda14cbcSMatt Macy.Pp
404eda14cbcSMatt MacyThe command to remove the mirrored log
40516038816SMartin Matuska.Ar mirror-2 No is :
40616038816SMartin Matuska.Dl # Nm zpool Cm remove Ar tank mirror-2
407eda14cbcSMatt Macy.Pp
408*718519f4SMartin MatuskaAt this point, the log device no longer exists
409*718519f4SMartin Matuska(both sides of the mirror have been removed):
410*718519f4SMartin Matuska.Bd -literal -compact -offset Ds
411*718519f4SMartin Matuska  pool: tank
412*718519f4SMartin Matuska state: ONLINE
413*718519f4SMartin Matuska  scan: none requested
414*718519f4SMartin Matuskaconfig:
415*718519f4SMartin Matuska
416*718519f4SMartin Matuska        NAME        STATE     READ WRITE CKSUM
417*718519f4SMartin Matuska        tank        ONLINE       0     0     0
418*718519f4SMartin Matuska          mirror-0  ONLINE       0     0     0
419*718519f4SMartin Matuska            sda     ONLINE       0     0     0
420*718519f4SMartin Matuska            sdb     ONLINE       0     0     0
421*718519f4SMartin Matuska          mirror-1  ONLINE       0     0     0
422*718519f4SMartin Matuska            sdc     ONLINE       0     0     0
423*718519f4SMartin Matuska            sdd     ONLINE       0     0     0
424*718519f4SMartin Matuska.Ed
425*718519f4SMartin Matuska.Pp
426eda14cbcSMatt MacyThe command to remove the mirrored data
42716038816SMartin Matuska.Ar mirror-1 No is :
42816038816SMartin Matuska.Dl # Nm zpool Cm remove Ar tank mirror-1
429*718519f4SMartin Matuska.Pp
430*718519f4SMartin MatuskaAfter
431*718519f4SMartin Matuska.Ar mirror-1 No has been evacuated, the pool remains redundant, but
432*718519f4SMartin Matuskathe total amount of space is reduced:
433*718519f4SMartin Matuska.Bd -literal -compact -offset Ds
434*718519f4SMartin Matuska  pool: tank
435*718519f4SMartin Matuska state: ONLINE
436*718519f4SMartin Matuska  scan: none requested
437*718519f4SMartin Matuskaconfig:
438*718519f4SMartin Matuska
439*718519f4SMartin Matuska        NAME        STATE     READ WRITE CKSUM
440*718519f4SMartin Matuska        tank        ONLINE       0     0     0
441*718519f4SMartin Matuska          mirror-0  ONLINE       0     0     0
442*718519f4SMartin Matuska            sda     ONLINE       0     0     0
443*718519f4SMartin Matuska            sdb     ONLINE       0     0     0
444*718519f4SMartin Matuska.Ed
44516038816SMartin Matuska.
4462ad756a6SMartin Matuska.Ss Example 16 : No Displaying expanded space on a device
447eda14cbcSMatt MacyThe following command displays the detailed information for the pool
44816038816SMartin Matuska.Ar data .
449eda14cbcSMatt MacyThis pool is comprised of a single raidz vdev where one of its devices
450716fd348SMartin Matuskaincreased its capacity by 10 GiB.
451eda14cbcSMatt MacyIn this example, the pool will not be able to utilize this extra capacity until
452eda14cbcSMatt Macyall the devices under the raidz vdev have been expanded.
45316038816SMartin Matuska.Bd -literal -compact -offset Ds
45416038816SMartin Matuska.No # Nm zpool Cm list Fl v Ar data
455eda14cbcSMatt MacyNAME         SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
456eda14cbcSMatt Macydata        23.9G  14.6G  9.30G         -    48%    61%  1.00x  ONLINE  -
457eda14cbcSMatt Macy  raidz1    23.9G  14.6G  9.30G         -    48%
458eda14cbcSMatt Macy    sda         -      -      -         -      -
459eda14cbcSMatt Macy    sdb         -      -      -       10G      -
460eda14cbcSMatt Macy    sdc         -      -      -         -      -
461eda14cbcSMatt Macy.Ed
46216038816SMartin Matuska.
4632ad756a6SMartin Matuska.Ss Example 17 : No Adding output columns
464eda14cbcSMatt MacyAdditional columns can be added to the
46516038816SMartin Matuska.Nm zpool Cm status No and Nm zpool Cm iostat No output with Fl c .
46616038816SMartin Matuska.Bd -literal -compact -offset Ds
467da5137abSMartin Matuska.No # Nm zpool Cm status Fl c Pa vendor , Ns Pa model , Ns Pa size
468eda14cbcSMatt Macy   NAME     STATE  READ WRITE CKSUM vendor  model        size
469eda14cbcSMatt Macy   tank     ONLINE 0    0     0
470eda14cbcSMatt Macy   mirror-0 ONLINE 0    0     0
471eda14cbcSMatt Macy   U1       ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
472eda14cbcSMatt Macy   U10      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
473eda14cbcSMatt Macy   U11      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
474eda14cbcSMatt Macy   U12      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
475eda14cbcSMatt Macy   U13      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
476eda14cbcSMatt Macy   U14      ONLINE 0    0     0     SEAGATE ST8000NM0075 7.3T
477eda14cbcSMatt Macy
478da5137abSMartin Matuska.No # Nm zpool Cm iostat Fl vc Pa size
479eda14cbcSMatt Macy              capacity     operations     bandwidth
480eda14cbcSMatt Macypool        alloc   free   read  write   read  write  size
481eda14cbcSMatt Macy----------  -----  -----  -----  -----  -----  -----  ----
482eda14cbcSMatt Macyrpool       14.6G  54.9G      4     55   250K  2.69M
483eda14cbcSMatt Macy  sda1      14.6G  54.9G      4     55   250K  2.69M   70G
484eda14cbcSMatt Macy----------  -----  -----  -----  -----  -----  -----  ----
485eda14cbcSMatt Macy.Ed
48616038816SMartin Matuska.
487eda14cbcSMatt Macy.Sh ENVIRONMENT VARIABLES
488b356da80SMartin Matuska.Bl -tag -compact -width "ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE"
48916038816SMartin Matuska.It Sy ZFS_ABORT
490eda14cbcSMatt MacyCause
49116038816SMartin Matuska.Nm
492eda14cbcSMatt Macyto dump core on exit for the purposes of running
493eda14cbcSMatt Macy.Sy ::findleaks .
49416038816SMartin Matuska.It Sy ZFS_COLOR
495eda14cbcSMatt MacyUse ANSI color in
496da5137abSMartin Matuska.Nm zpool Cm status
4972a58b312SMartin Matuskaand
4982a58b312SMartin Matuska.Nm zpool Cm iostat
499eda14cbcSMatt Macyoutput.
500b356da80SMartin Matuska.It Sy ZPOOL_AUTO_POWER_ON_SLOT
501b356da80SMartin MatuskaAutomatically attempt to turn on the drives enclosure slot power to a drive when
502b356da80SMartin Matuskarunning the
503b356da80SMartin Matuska.Nm zpool Cm online
504b356da80SMartin Matuskaor
505b356da80SMartin Matuska.Nm zpool Cm clear
506b356da80SMartin Matuskacommands.
507b356da80SMartin MatuskaThis has the same effect as passing the
508b356da80SMartin Matuska.Fl -power
509b356da80SMartin Matuskaoption to those commands.
510b356da80SMartin Matuska.It Sy ZPOOL_POWER_ON_SLOT_TIMEOUT_MS
511b356da80SMartin MatuskaThe maximum time in milliseconds to wait for a slot power sysfs value
512b356da80SMartin Matuskato return the correct value after writing it.
513b356da80SMartin MatuskaFor example, after writing "on" to the sysfs enclosure slot power_control file,
514b356da80SMartin Matuskait can take some time for the enclosure to power down the slot and return
515b356da80SMartin Matuska"on" if you read back the 'power_control' value.
516b356da80SMartin MatuskaDefaults to 30 seconds (30000ms) if not set.
51716038816SMartin Matuska.It Sy ZPOOL_IMPORT_PATH
51816038816SMartin MatuskaThe search path for devices or files to use with the pool.
51916038816SMartin MatuskaThis is a colon-separated list of directories in which
52016038816SMartin Matuska.Nm
521eda14cbcSMatt Macylooks for device nodes and files.
522eda14cbcSMatt MacySimilar to the
523eda14cbcSMatt Macy.Fl d
524eda14cbcSMatt Macyoption in
525eda14cbcSMatt Macy.Nm zpool import .
52616038816SMartin Matuska.It Sy ZPOOL_IMPORT_UDEV_TIMEOUT_MS
527eda14cbcSMatt MacyThe maximum time in milliseconds that
528eda14cbcSMatt Macy.Nm zpool import
529eda14cbcSMatt Macywill wait for an expected device to be available.
53016038816SMartin Matuska.It Sy ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE
531eda14cbcSMatt MacyIf set, suppress warning about non-native vdev ashift in
532da5137abSMartin Matuska.Nm zpool Cm status .
533eda14cbcSMatt MacyThe value is not used, only the presence or absence of the variable matters.
53416038816SMartin Matuska.It Sy ZPOOL_VDEV_NAME_GUID
535eda14cbcSMatt MacyCause
53616038816SMartin Matuska.Nm
53716038816SMartin Matuskasubcommands to output vdev guids by default.
53816038816SMartin MatuskaThis behavior is identical to the
53916038816SMartin Matuska.Nm zpool Cm status Fl g
540eda14cbcSMatt Macycommand line option.
54116038816SMartin Matuska.It Sy ZPOOL_VDEV_NAME_FOLLOW_LINKS
542eda14cbcSMatt MacyCause
54316038816SMartin Matuska.Nm
54416038816SMartin Matuskasubcommands to follow links for vdev names by default.
54516038816SMartin MatuskaThis behavior is identical to the
54616038816SMartin Matuska.Nm zpool Cm status Fl L
547eda14cbcSMatt Macycommand line option.
54816038816SMartin Matuska.It Sy ZPOOL_VDEV_NAME_PATH
549eda14cbcSMatt MacyCause
55016038816SMartin Matuska.Nm
55116038816SMartin Matuskasubcommands to output full vdev path names by default.
55216038816SMartin MatuskaThis behavior is identical to the
55316038816SMartin Matuska.Nm zpool Cm status Fl P
554eda14cbcSMatt Macycommand line option.
55516038816SMartin Matuska.It Sy ZFS_VDEV_DEVID_OPT_OUT
556180f8225SMatt MacyOlder OpenZFS implementations had issues when attempting to display pool
557c03c5b1cSMartin Matuskaconfig vdev names if a
558eda14cbcSMatt Macy.Sy devid
559eda14cbcSMatt MacyNVP value is present in the pool's config.
560eda14cbcSMatt Macy.Pp
56116038816SMartin MatuskaFor example, a pool that originated on illumos platform would have a
56216038816SMartin Matuska.Sy devid
563eda14cbcSMatt Macyvalue in the config and
564da5137abSMartin Matuska.Nm zpool Cm status
565eda14cbcSMatt Macywould fail when listing the config.
56616038816SMartin MatuskaThis would also be true for future Linux-based pools.
567eda14cbcSMatt Macy.Pp
568eda14cbcSMatt MacyA pool can be stripped of any
569eda14cbcSMatt Macy.Sy devid
570eda14cbcSMatt Macyvalues on import or prevented from adding
571eda14cbcSMatt Macythem on
57216038816SMartin Matuska.Nm zpool Cm create
573eda14cbcSMatt Macyor
57416038816SMartin Matuska.Nm zpool Cm add
575eda14cbcSMatt Macyby setting
576eda14cbcSMatt Macy.Sy ZFS_VDEV_DEVID_OPT_OUT .
57716038816SMartin Matuska.Pp
57816038816SMartin Matuska.It Sy ZPOOL_SCRIPTS_AS_ROOT
57916038816SMartin MatuskaAllow a privileged user to run
580da5137abSMartin Matuska.Nm zpool Cm status Ns / Ns Cm iostat Fl c .
58116038816SMartin MatuskaNormally, only unprivileged users are allowed to run
582eda14cbcSMatt Macy.Fl c .
58316038816SMartin Matuska.It Sy ZPOOL_SCRIPTS_PATH
584eda14cbcSMatt MacyThe search path for scripts when running
585da5137abSMartin Matuska.Nm zpool Cm status Ns / Ns Cm iostat Fl c .
58616038816SMartin MatuskaThis is a colon-separated list of directories and overrides the default
587eda14cbcSMatt Macy.Pa ~/.zpool.d
588eda14cbcSMatt Macyand
589eda14cbcSMatt Macy.Pa /etc/zfs/zpool.d
590eda14cbcSMatt Macysearch paths.
59116038816SMartin Matuska.It Sy ZPOOL_SCRIPTS_ENABLED
592eda14cbcSMatt MacyAllow a user to run
593da5137abSMartin Matuska.Nm zpool Cm status Ns / Ns Cm iostat Fl c .
59416038816SMartin MatuskaIf
595eda14cbcSMatt Macy.Sy ZPOOL_SCRIPTS_ENABLED
596eda14cbcSMatt Macyis not set, it is assumed that the user is allowed to run
59716038816SMartin Matuska.Nm zpool Cm status Ns / Ns Cm iostat Fl c .
598e3aa18adSMartin Matuska.\" Shared with zfs.8
599e3aa18adSMartin Matuska.It Sy ZFS_MODULE_TIMEOUT
600e3aa18adSMartin MatuskaTime, in seconds, to wait for
601e3aa18adSMartin Matuska.Pa /dev/zfs
602e3aa18adSMartin Matuskato appear.
603e3aa18adSMartin MatuskaDefaults to
604e3aa18adSMartin Matuska.Sy 10 ,
605e3aa18adSMartin Matuskamax
606e3aa18adSMartin Matuska.Sy 600 Pq 10 minutes .
607e3aa18adSMartin MatuskaIf
608e3aa18adSMartin Matuska.Pf < Sy 0 ,
609e3aa18adSMartin Matuskawait forever; if
610e3aa18adSMartin Matuska.Sy 0 ,
611e3aa18adSMartin Matuskadon't wait.
612eda14cbcSMatt Macy.El
61316038816SMartin Matuska.
614eda14cbcSMatt Macy.Sh INTERFACE STABILITY
615eda14cbcSMatt Macy.Sy Evolving
61616038816SMartin Matuska.
617eda14cbcSMatt Macy.Sh SEE ALSO
6183ff01b23SMartin Matuska.Xr zfs 4 ,
6193ff01b23SMartin Matuska.Xr zpool-features 7 ,
6203ff01b23SMartin Matuska.Xr zpoolconcepts 7 ,
6213ff01b23SMartin Matuska.Xr zpoolprops 7 ,
622eda14cbcSMatt Macy.Xr zed 8 ,
623ac0bf12eSMatt Macy.Xr zfs 8 ,
624ac0bf12eSMatt Macy.Xr zpool-add 8 ,
625ac0bf12eSMatt Macy.Xr zpool-attach 8 ,
626ac0bf12eSMatt Macy.Xr zpool-checkpoint 8 ,
627ac0bf12eSMatt Macy.Xr zpool-clear 8 ,
628ac0bf12eSMatt Macy.Xr zpool-create 8 ,
629e2df9bb4SMartin Matuska.Xr zpool-ddtprune 8 ,
630ac0bf12eSMatt Macy.Xr zpool-destroy 8 ,
631ac0bf12eSMatt Macy.Xr zpool-detach 8 ,
632ac0bf12eSMatt Macy.Xr zpool-events 8 ,
633ac0bf12eSMatt Macy.Xr zpool-export 8 ,
634ac0bf12eSMatt Macy.Xr zpool-get 8 ,
635ac0bf12eSMatt Macy.Xr zpool-history 8 ,
636ac0bf12eSMatt Macy.Xr zpool-import 8 ,
637ac0bf12eSMatt Macy.Xr zpool-initialize 8 ,
638ac0bf12eSMatt Macy.Xr zpool-iostat 8 ,
639ac0bf12eSMatt Macy.Xr zpool-labelclear 8 ,
640ac0bf12eSMatt Macy.Xr zpool-list 8 ,
641ac0bf12eSMatt Macy.Xr zpool-offline 8 ,
642ac0bf12eSMatt Macy.Xr zpool-online 8 ,
643ce4dcb97SMartin Matuska.Xr zpool-prefetch 8 ,
644ac0bf12eSMatt Macy.Xr zpool-reguid 8 ,
645ac0bf12eSMatt Macy.Xr zpool-remove 8 ,
646ac0bf12eSMatt Macy.Xr zpool-reopen 8 ,
647ac0bf12eSMatt Macy.Xr zpool-replace 8 ,
648ac0bf12eSMatt Macy.Xr zpool-resilver 8 ,
649ac0bf12eSMatt Macy.Xr zpool-scrub 8 ,
650ac0bf12eSMatt Macy.Xr zpool-set 8 ,
651ac0bf12eSMatt Macy.Xr zpool-split 8 ,
652ac0bf12eSMatt Macy.Xr zpool-status 8 ,
653ac0bf12eSMatt Macy.Xr zpool-sync 8 ,
654ac0bf12eSMatt Macy.Xr zpool-trim 8 ,
655ac0bf12eSMatt Macy.Xr zpool-upgrade 8 ,
6563ff01b23SMartin Matuska.Xr zpool-wait 8
657