]> git.proxmox.com Git - mirror_zfs.git/blame - man/man8/zpool.8
Colorize zpool status output
[mirror_zfs.git] / man / man8 / zpool.8
CommitLineData
cda0317e
GM
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 http://www.opensolaris.org/os/licensing.
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.\"
058ac9ba 22.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
a448a255 23.\" Copyright (c) 2012, 2018 by Delphix. All rights reserved.
df831108 24.\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
bec1067d 25.\" Copyright (c) 2017 Datto Inc.
eb201f50 26.\" Copyright (c) 2018 George Melikov. All Rights Reserved.
d7323e79 27.\" Copyright 2017 Nexenta Systems, Inc.
d3f2cd7e 28.\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
9ae529ec 29.\"
e60e158e 30.Dd August 9, 2019
c5ebfbbe 31.Dt ZPOOL 8
cda0317e
GM
32.Os Linux
33.Sh NAME
34.Nm zpool
35.Nd configure ZFS storage pools
36.Sh SYNOPSIS
37.Nm
50478c6d 38.Fl ?V
cda0317e 39.Nm
50478c6d 40.Cm version
c5ebfbbe
RW
41.Nm
42.Cm <subcommand>
43.Op Ar <args>
cda0317e
GM
44.Sh DESCRIPTION
45The
46.Nm
47command configures ZFS storage pools.
48A storage pool is a collection of devices that provides physical storage and
49data replication for ZFS datasets.
50All datasets within a storage pool share the same space.
51See
52.Xr zfs 8
53for information on managing datasets.
cda0317e 54.Pp
c5ebfbbe
RW
55For an overview of creating and managing ZFS storage pools see the
56.Xr zpoolconcepts 8
57manual page.
58.Sh SUBCOMMANDS
cda0317e
GM
59All subcommands that modify state are logged persistently to the pool in their
60original form.
61.Pp
62The
63.Nm
64command provides subcommands to create and destroy storage pools, add capacity
65to storage pools, and provide information about the storage pools.
66The following subcommands are supported:
67.Bl -tag -width Ds
68.It Xo
69.Nm
70.Fl ?
71.Xc
058ac9ba 72Displays a help message.
cda0317e
GM
73.It Xo
74.Nm
50478c6d
T
75.Fl V, -version
76.Xc
77An alias for the
78.Nm zpool Cm version
79subcommand.
80.It Xo
81.Nm
c5ebfbbe 82.Cm version
cda0317e 83.Xc
c5ebfbbe 84Displays the software version of the
cda0317e 85.Nm
c5ebfbbe 86userland utility and the zfs kernel module.
cda0317e 87.El
c5ebfbbe 88.Ss Creation
d2734cce 89.Bl -tag -width Ds
c5ebfbbe 90.It Xr zpool-create 8
cda0317e
GM
91Creates a new storage pool containing the virtual devices specified on the
92command line.
c5ebfbbe
RW
93.It Xr zpool-initialize 8
94Begins initializing by writing to all unallocated regions on the specified
95devices, or all eligible devices in the pool if no individual devices are
96specified.
cda0317e 97.El
c5ebfbbe 98.Ss Destruction
cda0317e 99.Bl -tag -width Ds
c5ebfbbe
RW
100.It Xr zpool-destroy 8
101Destroys the given pool, freeing up any devices for other use.
102.It Xr zpool-labelclear 8
103Removes ZFS label information from the specified
104.Ar device .
cda0317e 105.El
c5ebfbbe
RW
106.Ss Virtual Devices
107.Bl -tag -width Ds
cda0317e 108.It Xo
c5ebfbbe
RW
109.Xr zpool-attach 8 /
110.Xr zpool-detach 8
cda0317e 111.Xc
c5ebfbbe
RW
112Increases or decreases redundancy by
113.Cm attach Ns -ing or
114.Cm detach Ns -ing a device on an existing vdev (virtual device).
cda0317e 115.It Xo
c5ebfbbe
RW
116.Xr zpool-add 8 /
117.Xr zpool-remove 8
cda0317e 118.Xc
c5ebfbbe
RW
119Adds the specified virtual devices to the given pool,
120or removes the specified device from the pool.
121.It Xr zpool-replace 8
122Replaces an existing device (which may be faulted) with a new one.
123.It Xr zpool-split 8
124Creates a new pool by splitting all mirrors in an existing pool (which decreases its redundancy).
cda0317e 125.El
c5ebfbbe
RW
126.Ss Properties
127Available pool properties listed in the
128.Xr zpoolprops 8
129manual page.
cda0317e 130.Bl -tag -width Ds
c5ebfbbe
RW
131.It Xr zpool-list 8
132Lists the given pools along with a health status and space usage.
cda0317e 133.It Xo
c5ebfbbe
RW
134.Xr zpool-get 8 /
135.Xr zpool-set 8
cda0317e
GM
136.Xc
137Retrieves the given list of properties
138.Po
139or all properties if
140.Sy all
141is used
142.Pc
143for the specified storage pool(s).
cda0317e 144.El
c5ebfbbe 145.Ss Monitoring
cda0317e 146.Bl -tag -width Ds
c5ebfbbe
RW
147.It Xr zpool-status 8
148Displays the detailed health status for the given pools.
149.It Xr zpool-iostat 8
f8bb2a7e
KP
150Displays logical I/O statistics for the given pools/vdevs. Physical I/Os may
151be observed via
152.Xr iostat 1 .
c5ebfbbe
RW
153.It Xr zpool-events 8
154Lists all recent events generated by the ZFS kernel modules. These events
155are consumed by the
156.Xr zed 8
157and used to automate administrative tasks such as replacing a failed device
158with a hot spare. For more information about the subclasses and event payloads
159that can be generated see the
160.Xr zfs-events 5
161man page.
162.It Xr zpool-history 8
163Displays the command history of the specified pool(s) or all pools if no pool is
164specified.
a1d477c2 165.El
c5ebfbbe 166.Ss Maintenance
cda0317e 167.Bl -tag -width Ds
c5ebfbbe 168.It Xr zpool-scrub 8
0ea05c64 169Begins a scrub or resumes a paused scrub.
c5ebfbbe
RW
170.It Xr zpool-checkpoint 8
171Checkpoints the current state of
1b939560 172.Ar pool
c5ebfbbe
RW
173, which can be later restored by
174.Nm zpool Cm import --rewind-to-checkpoint .
175.It Xr zpool-trim 8
1b939560
BB
176Initiates an immediate on-demand TRIM operation for all of the free space in
177a pool. This operation informs the underlying storage devices of all blocks
178in the pool which are no longer allocated and allows thinly provisioned
179devices to reclaim the space.
c5ebfbbe 180.It Xr zpool-sync 8
cda0317e
GM
181This command forces all in-core dirty data to be written to the primary
182pool storage and not the ZIL. It will also update administrative
183information including quota reporting. Without arguments,
184.Sy zpool sync
185will sync all pools on the system. Otherwise, it will sync only the
186specified pool(s).
c5ebfbbe
RW
187.It Xr zpool-upgrade 8
188Manage the on-disk format version of storage pools.
189.It Xr zpool-wait 8
e60e158e
JG
190Waits until all background activity of the given types has ceased in the given
191pool.
c5ebfbbe
RW
192.El
193.Ss Fault Resolution
e60e158e 194.Bl -tag -width Ds
c5ebfbbe
RW
195.It Xo
196.Xr zpool-offline 8
197.Xr zpool-online 8
198.Xc
199Takes the specified physical device offline or brings it online.
200.It Xr zpool-resilver 8
201Starts a resilver. If an existing resilver is already running it will be
202restarted from the beginning.
203.It Xr zpool-reopen 8
204Reopen all the vdevs associated with the pool.
205.It Xr zpool-clear 8
206Clears device errors in a pool.
e60e158e 207.El
c5ebfbbe
RW
208.Ss Import & Export
209.Bl -tag -width Ds
210.It Xr zpool-import 8
211Make disks containing ZFS storage pools available for use on the system.
212.It Xr zpool-export 8
213Exports the given pools from the system.
214.It Xr zpool-reguid 8
215Generates a new unique identifier for the pool.
cda0317e
GM
216.El
217.Sh EXIT STATUS
218The following exit values are returned:
219.Bl -tag -width Ds
220.It Sy 0
221Successful completion.
222.It Sy 1
223An error occurred.
224.It Sy 2
225Invalid command line options were specified.
226.El
227.Sh EXAMPLES
228.Bl -tag -width Ds
229.It Sy Example 1 No Creating a RAID-Z Storage Pool
230The following command creates a pool with a single raidz root vdev that
231consists of six disks.
232.Bd -literal
233# zpool create tank raidz sda sdb sdc sdd sde sdf
234.Ed
235.It Sy Example 2 No Creating a Mirrored Storage Pool
236The following command creates a pool with two mirrors, where each mirror
237contains two disks.
238.Bd -literal
239# zpool create tank mirror sda sdb mirror sdc sdd
240.Ed
241.It Sy Example 3 No Creating a ZFS Storage Pool by Using Partitions
54e5f226 242The following command creates an unmirrored pool using two disk partitions.
cda0317e
GM
243.Bd -literal
244# zpool create tank sda1 sdb2
245.Ed
246.It Sy Example 4 No Creating a ZFS Storage Pool by Using Files
247The following command creates an unmirrored pool using files.
248While not recommended, a pool based on files can be useful for experimental
249purposes.
250.Bd -literal
251# zpool create tank /path/to/file/a /path/to/file/b
252.Ed
253.It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool
254The following command adds two mirrored disks to the pool
255.Em tank ,
256assuming the pool is already made up of two-way mirrors.
257The additional space is immediately available to any datasets within the pool.
258.Bd -literal
259# zpool add tank mirror sda sdb
260.Ed
261.It Sy Example 6 No Listing Available ZFS Storage Pools
262The following command lists all available pools on the system.
263In this case, the pool
264.Em zion
265is faulted due to a missing device.
058ac9ba 266The results from this command are similar to the following:
cda0317e
GM
267.Bd -literal
268# zpool list
d72cd017
TK
269NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
270rpool 19.9G 8.43G 11.4G - 33% 42% 1.00x ONLINE -
271tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE -
272zion - - - - - - - FAULTED -
cda0317e
GM
273.Ed
274.It Sy Example 7 No Destroying a ZFS Storage Pool
275The following command destroys the pool
276.Em tank
277and any datasets contained within.
278.Bd -literal
279# zpool destroy -f tank
280.Ed
281.It Sy Example 8 No Exporting a ZFS Storage Pool
282The following command exports the devices in pool
283.Em tank
284so that they can be relocated or later imported.
285.Bd -literal
286# zpool export tank
287.Ed
288.It Sy Example 9 No Importing a ZFS Storage Pool
289The following command displays available pools, and then imports the pool
290.Em tank
291for use on the system.
058ac9ba 292The results from this command are similar to the following:
cda0317e
GM
293.Bd -literal
294# zpool import
058ac9ba
BB
295 pool: tank
296 id: 15451357997522795478
297 state: ONLINE
298action: The pool can be imported using its name or numeric identifier.
299config:
300
301 tank ONLINE
302 mirror ONLINE
54e5f226
RL
303 sda ONLINE
304 sdb ONLINE
058ac9ba 305
cda0317e
GM
306# zpool import tank
307.Ed
308.It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version
309The following command upgrades all ZFS Storage pools to the current version of
310the software.
311.Bd -literal
312# zpool upgrade -a
313This system is currently running ZFS version 2.
314.Ed
315.It Sy Example 11 No Managing Hot Spares
058ac9ba 316The following command creates a new pool with an available hot spare:
cda0317e
GM
317.Bd -literal
318# zpool create tank mirror sda sdb spare sdc
319.Ed
320.Pp
321If one of the disks were to fail, the pool would be reduced to the degraded
322state.
323The failed device can be replaced using the following command:
324.Bd -literal
325# zpool replace tank sda sdd
326.Ed
327.Pp
328Once the data has been resilvered, the spare is automatically removed and is
7c9abcf8 329made available for use should another device fail.
cda0317e
GM
330The hot spare can be permanently removed from the pool using the following
331command:
332.Bd -literal
333# zpool remove tank sdc
334.Ed
335.It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs
336The following command creates a ZFS storage pool consisting of two, two-way
337mirrors and mirrored log devices:
338.Bd -literal
339# zpool create pool mirror sda sdb mirror sdc sdd log mirror \\
340 sde sdf
341.Ed
342.It Sy Example 13 No Adding Cache Devices to a ZFS Pool
343The following command adds two disks for use as cache devices to a ZFS storage
344pool:
345.Bd -literal
346# zpool add pool cache sdc sdd
347.Ed
348.Pp
349Once added, the cache devices gradually fill with content from main memory.
350Depending on the size of your cache devices, it could take over an hour for
351them to fill.
352Capacity and reads can be monitored using the
353.Cm iostat
354option as follows:
355.Bd -literal
356# zpool iostat -v pool 5
357.Ed
a1d477c2
MA
358.It Sy Example 14 No Removing a Mirrored top-level (Log or Data) Device
359The following commands remove the mirrored log device
360.Sy mirror-2
361and mirrored top-level data device
362.Sy mirror-1 .
363.Pp
058ac9ba 364Given this configuration:
cda0317e
GM
365.Bd -literal
366 pool: tank
367 state: ONLINE
368 scrub: none requested
058ac9ba
BB
369config:
370
371 NAME STATE READ WRITE CKSUM
372 tank ONLINE 0 0 0
373 mirror-0 ONLINE 0 0 0
54e5f226
RL
374 sda ONLINE 0 0 0
375 sdb ONLINE 0 0 0
058ac9ba 376 mirror-1 ONLINE 0 0 0
54e5f226
RL
377 sdc ONLINE 0 0 0
378 sdd ONLINE 0 0 0
058ac9ba
BB
379 logs
380 mirror-2 ONLINE 0 0 0
54e5f226
RL
381 sde ONLINE 0 0 0
382 sdf ONLINE 0 0 0
cda0317e
GM
383.Ed
384.Pp
385The command to remove the mirrored log
386.Sy mirror-2
387is:
388.Bd -literal
389# zpool remove tank mirror-2
390.Ed
a1d477c2
MA
391.Pp
392The command to remove the mirrored data
393.Sy mirror-1
394is:
395.Bd -literal
396# zpool remove tank mirror-1
397.Ed
cda0317e
GM
398.It Sy Example 15 No Displaying expanded space on a device
399The following command displays the detailed information for the pool
400.Em data .
401This pool is comprised of a single raidz vdev where one of its devices
402increased its capacity by 10GB.
403In this example, the pool will not be able to utilize this extra capacity until
404all the devices under the raidz vdev have been expanded.
405.Bd -literal
406# zpool list -v data
d72cd017
TK
407NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
408data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE -
409 raidz1 23.9G 14.6G 9.30G - 48%
410 sda - - - - -
411 sdb - - - 10G -
412 sdc - - - - -
cda0317e
GM
413.Ed
414.It Sy Example 16 No Adding output columns
415Additional columns can be added to the
416.Nm zpool Cm status
417and
418.Nm zpool Cm iostat
419output with
420.Fl c
421option.
422.Bd -literal
423# zpool status -c vendor,model,size
424 NAME STATE READ WRITE CKSUM vendor model size
425 tank ONLINE 0 0 0
426 mirror-0 ONLINE 0 0 0
427 U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
428 U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
429 U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
430 U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
431 U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
432 U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
433
434# zpool iostat -vc slaves
435 capacity operations bandwidth
436 pool alloc free read write read write slaves
437 ---------- ----- ----- ----- ----- ----- ----- ---------
438 tank 20.4G 7.23T 26 152 20.7M 21.6M
439 mirror 20.4G 7.23T 26 152 20.7M 21.6M
440 U1 - - 0 31 1.46K 20.6M sdb sdff
441 U10 - - 0 1 3.77K 13.3K sdas sdgw
442 U11 - - 0 1 288K 13.3K sdat sdgx
443 U12 - - 0 1 78.4K 13.3K sdau sdgy
444 U13 - - 0 1 128K 13.3K sdav sdgz
445 U14 - - 0 1 63.2K 13.3K sdfk sdg
446.Ed
447.El
448.Sh ENVIRONMENT VARIABLES
449.Bl -tag -width "ZFS_ABORT"
450.It Ev ZFS_ABORT
451Cause
452.Nm zpool
453to dump core on exit for the purposes of running
90cdf283 454.Sy ::findleaks .
cda0317e 455.El
9fb2771a
TH
456.Bl -tag -width "ZFS_COLOR"
457.It Ev ZFS_COLOR
458Use ANSI color in
459.Nm zpool status
460output.
461.El
cda0317e
GM
462.Bl -tag -width "ZPOOL_IMPORT_PATH"
463.It Ev ZPOOL_IMPORT_PATH
464The search path for devices or files to use with the pool. This is a colon-separated list of directories in which
465.Nm zpool
466looks for device nodes and files.
467Similar to the
468.Fl d
469option in
470.Nm zpool import .
471.El
80388421
RY
472.Bl -tag -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS"
473.It Ev ZPOOL_IMPORT_UDEV_TIMEOUT_MS
474The maximum time in milliseconds that
475.Nm zpool import
476will wait for an expected device to be available.
477.El
cda0317e
GM
478.Bl -tag -width "ZPOOL_VDEV_NAME_GUID"
479.It Ev ZPOOL_VDEV_NAME_GUID
480Cause
2de17298
TK
481.Nm zpool
482subcommands to output vdev guids by default. This behavior is identical to the
cda0317e
GM
483.Nm zpool status -g
484command line option.
485.El
486.Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS"
487.It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS
488Cause
489.Nm zpool
490subcommands to follow links for vdev names by default. This behavior is identical to the
491.Nm zpool status -L
492command line option.
493.El
494.Bl -tag -width "ZPOOL_VDEV_NAME_PATH"
495.It Ev ZPOOL_VDEV_NAME_PATH
496Cause
497.Nm zpool
498subcommands to output full vdev path names by default. This
499behavior is identical to the
500.Nm zpool status -p
501command line option.
502.El
503.Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT"
504.It Ev ZFS_VDEV_DEVID_OPT_OUT
39fc0cb5 505Older ZFS on Linux implementations had issues when attempting to display pool
cda0317e
GM
506config VDEV names if a
507.Sy devid
508NVP value is present in the pool's config.
509.Pp
39fc0cb5 510For example, a pool that originated on illumos platform would have a devid
cda0317e
GM
511value in the config and
512.Nm zpool status
513would fail when listing the config.
39fc0cb5 514This would also be true for future Linux based pools.
cda0317e
GM
515.Pp
516A pool can be stripped of any
517.Sy devid
518values on import or prevented from adding
519them on
520.Nm zpool create
521or
522.Nm zpool add
523by setting
524.Sy ZFS_VDEV_DEVID_OPT_OUT .
525.El
526.Bl -tag -width "ZPOOL_SCRIPTS_AS_ROOT"
527.It Ev ZPOOL_SCRIPTS_AS_ROOT
7a8ed6b8 528Allow a privileged user to run the
cda0317e
GM
529.Nm zpool status/iostat
530with the
531.Fl c
7a8ed6b8 532option. Normally, only unprivileged users are allowed to run
cda0317e
GM
533.Fl c .
534.El
535.Bl -tag -width "ZPOOL_SCRIPTS_PATH"
536.It Ev ZPOOL_SCRIPTS_PATH
537The search path for scripts when running
538.Nm zpool status/iostat
539with the
540.Fl c
099700d9 541option. This is a colon-separated list of directories and overrides the default
cda0317e
GM
542.Pa ~/.zpool.d
543and
544.Pa /etc/zfs/zpool.d
545search paths.
546.El
547.Bl -tag -width "ZPOOL_SCRIPTS_ENABLED"
548.It Ev ZPOOL_SCRIPTS_ENABLED
549Allow a user to run
550.Nm zpool status/iostat
551with the
552.Fl c
553option. If
554.Sy ZPOOL_SCRIPTS_ENABLED
555is not set, it is assumed that the user is allowed to run
556.Nm zpool status/iostat -c .
90cdf283 557.El
cda0317e
GM
558.Sh INTERFACE STABILITY
559.Sy Evolving
560.Sh SEE ALSO
c5ebfbbe
RW
561.Xr zpoolconcepts 8 ,
562.Xr zpoolprops 8 ,
cda0317e
GM
563.Xr zfs-events 5 ,
564.Xr zfs-module-parameters 5 ,
90cdf283 565.Xr zpool-features 5 ,
566.Xr zed 8 ,
567.Xr zfs 8