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