]> git.proxmox.com Git - mirror_zfs.git/blob - man/man8/zpool.8
4eea6689d857adf92f0595409947ce26c2c87573
[mirror_zfs.git] / man / man8 / zpool.8
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 .\"
22 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
23 .\" Copyright (c) 2013 by Delphix. All rights reserved.
24 .\" Copyright (c) 2012 Cyril Plisko. All Rights Reserved.
25 .\" Copyright (c) 2017 Datto Inc.
26 .\" Copyright (c) 2017 George Melikov. All Rights Reserved.
27 .\" Copyright 2017 Nexenta Systems, Inc.
28 .\" Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
29 .\"
30 .Dd August 23, 2017
31 .Dt ZPOOL 8 SMM
32 .Os Linux
33 .Sh NAME
34 .Nm zpool
35 .Nd configure ZFS storage pools
36 .Sh SYNOPSIS
37 .Nm
38 .Fl ?
39 .Nm
40 .Cm add
41 .Op Fl fgLnP
42 .Oo Fl o Ar property Ns = Ns Ar value Oc
43 .Ar pool vdev Ns ...
44 .Nm
45 .Cm attach
46 .Op Fl f
47 .Oo Fl o Ar property Ns = Ns Ar value Oc
48 .Ar pool device new_device
49 .Nm
50 .Cm clear
51 .Ar pool
52 .Op Ar device
53 .Nm
54 .Cm create
55 .Op Fl dfn
56 .Op Fl m Ar mountpoint
57 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
58 .Oo Fl o Ar feature@feature Ns = Ns Ar value Oc
59 .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
60 .Op Fl R Ar root
61 .Ar pool vdev Ns ...
62 .Nm
63 .Cm destroy
64 .Op Fl f
65 .Ar pool
66 .Nm
67 .Cm detach
68 .Ar pool device
69 .Nm
70 .Cm events
71 .Op Fl vHf Oo Ar pool Oc | Fl c
72 .Nm
73 .Cm export
74 .Op Fl a
75 .Op Fl f
76 .Ar pool Ns ...
77 .Nm
78 .Cm get
79 .Op Fl Hp
80 .Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
81 .Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
82 .Ar pool Ns ...
83 .Nm
84 .Cm history
85 .Op Fl il
86 .Oo Ar pool Oc Ns ...
87 .Nm
88 .Cm import
89 .Op Fl D
90 .Op Fl d Ar dir
91 .Nm
92 .Cm import
93 .Fl a
94 .Op Fl DflmN
95 .Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
96 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
97 .Op Fl o Ar mntopts
98 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
99 .Op Fl R Ar root
100 .Nm
101 .Cm import
102 .Op Fl Dflm
103 .Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
104 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
105 .Op Fl o Ar mntopts
106 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
107 .Op Fl R Ar root
108 .Op Fl s
109 .Ar pool Ns | Ns Ar id
110 .Op Ar newpool Oo Fl t Oc
111 .Nm
112 .Cm iostat
113 .Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
114 .Op Fl T Sy u Ns | Ns Sy d
115 .Op Fl ghHLpPvy
116 .Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
117 .Op Ar interval Op Ar count
118 .Nm
119 .Cm labelclear
120 .Op Fl f
121 .Ar device
122 .Nm
123 .Cm list
124 .Op Fl HgLpPv
125 .Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
126 .Op Fl T Sy u Ns | Ns Sy d
127 .Oo Ar pool Oc Ns ...
128 .Op Ar interval Op Ar count
129 .Nm
130 .Cm offline
131 .Op Fl f
132 .Op Fl t
133 .Ar pool Ar device Ns ...
134 .Nm
135 .Cm online
136 .Op Fl e
137 .Ar pool Ar device Ns ...
138 .Nm
139 .Cm reguid
140 .Ar pool
141 .Nm
142 .Cm reopen
143 .Op Fl n
144 .Ar pool
145 .Nm
146 .Cm remove
147 .Ar pool Ar device Ns ...
148 .Nm
149 .Cm replace
150 .Op Fl f
151 .Oo Fl o Ar property Ns = Ns Ar value Oc
152 .Ar pool Ar device Op Ar new_device
153 .Nm
154 .Cm scrub
155 .Op Fl s | Fl p
156 .Ar pool Ns ...
157 .Nm
158 .Cm set
159 .Ar property Ns = Ns Ar value
160 .Ar pool
161 .Nm
162 .Cm split
163 .Op Fl gLlnP
164 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
165 .Op Fl R Ar root
166 .Ar pool newpool
167 .Oo Ar device Oc Ns ...
168 .Nm
169 .Cm status
170 .Oo Fl c Ar SCRIPT Oc
171 .Op Fl gLPvxD
172 .Op Fl T Sy u Ns | Ns Sy d
173 .Oo Ar pool Oc Ns ...
174 .Op Ar interval Op Ar count
175 .Nm
176 .Cm sync
177 .Oo Ar pool Oc Ns ...
178 .Nm
179 .Cm upgrade
180 .Nm
181 .Cm upgrade
182 .Fl v
183 .Nm
184 .Cm upgrade
185 .Op Fl V Ar version
186 .Fl a Ns | Ns Ar pool Ns ...
187 .Sh DESCRIPTION
188 The
189 .Nm
190 command configures ZFS storage pools.
191 A storage pool is a collection of devices that provides physical storage and
192 data replication for ZFS datasets.
193 All datasets within a storage pool share the same space.
194 See
195 .Xr zfs 8
196 for information on managing datasets.
197 .Ss Virtual Devices (vdevs)
198 A "virtual device" describes a single device or a collection of devices
199 organized according to certain performance and fault characteristics.
200 The following virtual devices are supported:
201 .Bl -tag -width Ds
202 .It Sy disk
203 A block device, typically located under
204 .Pa /dev .
205 ZFS can use individual slices or partitions, though the recommended mode of
206 operation is to use whole disks.
207 A disk can be specified by a full path, or it can be a shorthand name
208 .Po the relative portion of the path under
209 .Pa /dev
210 .Pc .
211 A whole disk can be specified by omitting the slice or partition designation.
212 For example,
213 .Pa sda
214 is equivalent to
215 .Pa /dev/sda .
216 When given a whole disk, ZFS automatically labels the disk, if necessary.
217 .It Sy file
218 A regular file.
219 The use of files as a backing store is strongly discouraged.
220 It is designed primarily for experimental purposes, as the fault tolerance of a
221 file is only as good as the file system of which it is a part.
222 A file must be specified by a full path.
223 .It Sy mirror
224 A mirror of two or more devices.
225 Data is replicated in an identical fashion across all components of a mirror.
226 A mirror with N disks of size X can hold X bytes and can withstand (N-1) devices
227 failing before data integrity is compromised.
228 .It Sy raidz , raidz1 , raidz2 , raidz3
229 A variation on RAID-5 that allows for better distribution of parity and
230 eliminates the RAID-5
231 .Qq write hole
232 .Pq in which data and parity become inconsistent after a power loss .
233 Data and parity is striped across all disks within a raidz group.
234 .Pp
235 A raidz group can have single-, double-, or triple-parity, meaning that the
236 raidz group can sustain one, two, or three failures, respectively, without
237 losing any data.
238 The
239 .Sy raidz1
240 vdev type specifies a single-parity raidz group; the
241 .Sy raidz2
242 vdev type specifies a double-parity raidz group; and the
243 .Sy raidz3
244 vdev type specifies a triple-parity raidz group.
245 The
246 .Sy raidz
247 vdev type is an alias for
248 .Sy raidz1 .
249 .Pp
250 A raidz group with N disks of size X with P parity disks can hold approximately
251 (N-P)*X bytes and can withstand P device(s) failing before data integrity is
252 compromised.
253 The minimum number of devices in a raidz group is one more than the number of
254 parity disks.
255 The recommended number is between 3 and 9 to help increase performance.
256 .It Sy spare
257 A special pseudo-vdev which keeps track of available hot spares for a pool.
258 For more information, see the
259 .Sx Hot Spares
260 section.
261 .It Sy log
262 A separate intent log device.
263 If more than one log device is specified, then writes are load-balanced between
264 devices.
265 Log devices can be mirrored.
266 However, raidz vdev types are not supported for the intent log.
267 For more information, see the
268 .Sx Intent Log
269 section.
270 .It Sy cache
271 A device used to cache storage pool data.
272 A cache device cannot be configured as a mirror or raidz group.
273 For more information, see the
274 .Sx Cache Devices
275 section.
276 .El
277 .Pp
278 Virtual devices cannot be nested, so a mirror or raidz virtual device can only
279 contain files or disks.
280 Mirrors of mirrors
281 .Pq or other combinations
282 are not allowed.
283 .Pp
284 A pool can have any number of virtual devices at the top of the configuration
285 .Po known as
286 .Qq root vdevs
287 .Pc .
288 Data is dynamically distributed across all top-level devices to balance data
289 among devices.
290 As new virtual devices are added, ZFS automatically places data on the newly
291 available devices.
292 .Pp
293 Virtual devices are specified one at a time on the command line, separated by
294 whitespace.
295 The keywords
296 .Sy mirror
297 and
298 .Sy raidz
299 are used to distinguish where a group ends and another begins.
300 For example, the following creates two root vdevs, each a mirror of two disks:
301 .Bd -literal
302 # zpool create mypool mirror sda sdb mirror sdc sdd
303 .Ed
304 .Ss Device Failure and Recovery
305 ZFS supports a rich set of mechanisms for handling device failure and data
306 corruption.
307 All metadata and data is checksummed, and ZFS automatically repairs bad data
308 from a good copy when corruption is detected.
309 .Pp
310 In order to take advantage of these features, a pool must make use of some form
311 of redundancy, using either mirrored or raidz groups.
312 While ZFS supports running in a non-redundant configuration, where each root
313 vdev is simply a disk or file, this is strongly discouraged.
314 A single case of bit corruption can render some or all of your data unavailable.
315 .Pp
316 A pool's health status is described by one of three states: online, degraded,
317 or faulted.
318 An online pool has all devices operating normally.
319 A degraded pool is one in which one or more devices have failed, but the data is
320 still available due to a redundant configuration.
321 A faulted pool has corrupted metadata, or one or more faulted devices, and
322 insufficient replicas to continue functioning.
323 .Pp
324 The health of the top-level vdev, such as mirror or raidz device, is
325 potentially impacted by the state of its associated vdevs, or component
326 devices.
327 A top-level vdev or component device is in one of the following states:
328 .Bl -tag -width "DEGRADED"
329 .It Sy DEGRADED
330 One or more top-level vdevs is in the degraded state because one or more
331 component devices are offline.
332 Sufficient replicas exist to continue functioning.
333 .Pp
334 One or more component devices is in the degraded or faulted state, but
335 sufficient replicas exist to continue functioning.
336 The underlying conditions are as follows:
337 .Bl -bullet
338 .It
339 The number of checksum errors exceeds acceptable levels and the device is
340 degraded as an indication that something may be wrong.
341 ZFS continues to use the device as necessary.
342 .It
343 The number of I/O errors exceeds acceptable levels.
344 The device could not be marked as faulted because there are insufficient
345 replicas to continue functioning.
346 .El
347 .It Sy FAULTED
348 One or more top-level vdevs is in the faulted state because one or more
349 component devices are offline.
350 Insufficient replicas exist to continue functioning.
351 .Pp
352 One or more component devices is in the faulted state, and insufficient
353 replicas exist to continue functioning.
354 The underlying conditions are as follows:
355 .Bl -bullet
356 .It
357 The device could be opened, but the contents did not match expected values.
358 .It
359 The number of I/O errors exceeds acceptable levels and the device is faulted to
360 prevent further use of the device.
361 .El
362 .It Sy OFFLINE
363 The device was explicitly taken offline by the
364 .Nm zpool Cm offline
365 command.
366 .It Sy ONLINE
367 The device is online and functioning.
368 .It Sy REMOVED
369 The device was physically removed while the system was running.
370 Device removal detection is hardware-dependent and may not be supported on all
371 platforms.
372 .It Sy UNAVAIL
373 The device could not be opened.
374 If a pool is imported when a device was unavailable, then the device will be
375 identified by a unique identifier instead of its path since the path was never
376 correct in the first place.
377 .El
378 .Pp
379 If a device is removed and later re-attached to the system, ZFS attempts
380 to put the device online automatically.
381 Device attach detection is hardware-dependent and might not be supported on all
382 platforms.
383 .Ss Hot Spares
384 ZFS allows devices to be associated with pools as
385 .Qq hot spares .
386 These devices are not actively used in the pool, but when an active device
387 fails, it is automatically replaced by a hot spare.
388 To create a pool with hot spares, specify a
389 .Sy spare
390 vdev with any number of devices.
391 For example,
392 .Bd -literal
393 # zpool create pool mirror sda sdb spare sdc sdd
394 .Ed
395 .Pp
396 Spares can be shared across multiple pools, and can be added with the
397 .Nm zpool Cm add
398 command and removed with the
399 .Nm zpool Cm remove
400 command.
401 Once a spare replacement is initiated, a new
402 .Sy spare
403 vdev is created within the configuration that will remain there until the
404 original device is replaced.
405 At this point, the hot spare becomes available again if another device fails.
406 .Pp
407 If a pool has a shared spare that is currently being used, the pool can not be
408 exported since other pools may use this shared spare, which may lead to
409 potential data corruption.
410 .Pp
411 An in-progress spare replacement can be cancelled by detaching the hot spare.
412 If the original faulted device is detached, then the hot spare assumes its
413 place in the configuration, and is removed from the spare list of all active
414 pools.
415 .Pp
416 Spares cannot replace log devices.
417 .Ss Intent Log
418 The ZFS Intent Log (ZIL) satisfies POSIX requirements for synchronous
419 transactions.
420 For instance, databases often require their transactions to be on stable storage
421 devices when returning from a system call.
422 NFS and other applications can also use
423 .Xr fsync 2
424 to ensure data stability.
425 By default, the intent log is allocated from blocks within the main pool.
426 However, it might be possible to get better performance using separate intent
427 log devices such as NVRAM or a dedicated disk.
428 For example:
429 .Bd -literal
430 # zpool create pool sda sdb log sdc
431 .Ed
432 .Pp
433 Multiple log devices can also be specified, and they can be mirrored.
434 See the
435 .Sx EXAMPLES
436 section for an example of mirroring multiple log devices.
437 .Pp
438 Log devices can be added, replaced, attached, detached, and imported and
439 exported as part of the larger pool.
440 Mirrored log devices can be removed by specifying the top-level mirror for the
441 log.
442 .Ss Cache Devices
443 Devices can be added to a storage pool as
444 .Qq cache devices .
445 These devices provide an additional layer of caching between main memory and
446 disk.
447 For read-heavy workloads, where the working set size is much larger than what
448 can be cached in main memory, using cache devices allow much more of this
449 working set to be served from low latency media.
450 Using cache devices provides the greatest performance improvement for random
451 read-workloads of mostly static content.
452 .Pp
453 To create a pool with cache devices, specify a
454 .Sy cache
455 vdev with any number of devices.
456 For example:
457 .Bd -literal
458 # zpool create pool sda sdb cache sdc sdd
459 .Ed
460 .Pp
461 Cache devices cannot be mirrored or part of a raidz configuration.
462 If a read error is encountered on a cache device, that read I/O is reissued to
463 the original storage pool device, which might be part of a mirrored or raidz
464 configuration.
465 .Pp
466 The content of the cache devices is considered volatile, as is the case with
467 other system caches.
468 .Ss Properties
469 Each pool has several properties associated with it.
470 Some properties are read-only statistics while others are configurable and
471 change the behavior of the pool.
472 .Pp
473 The following are read-only properties:
474 .Bl -tag -width Ds
475 .It Sy available
476 Amount of storage available within the pool.
477 This property can also be referred to by its shortened column name,
478 .Sy avail .
479 .It Sy capacity
480 Percentage of pool space used.
481 This property can also be referred to by its shortened column name,
482 .Sy cap .
483 .It Sy expandsize
484 Amount of uninitialized space within the pool or device that can be used to
485 increase the total capacity of the pool.
486 Uninitialized space consists of any space on an EFI labeled vdev which has not
487 been brought online
488 .Po e.g, using
489 .Nm zpool Cm online Fl e
490 .Pc .
491 This space occurs when a LUN is dynamically expanded.
492 .It Sy fragmentation
493 The amount of fragmentation in the pool.
494 .It Sy free
495 The amount of free space available in the pool.
496 .It Sy freeing
497 After a file system or snapshot is destroyed, the space it was using is
498 returned to the pool asynchronously.
499 .Sy freeing
500 is the amount of space remaining to be reclaimed.
501 Over time
502 .Sy freeing
503 will decrease while
504 .Sy free
505 increases.
506 .It Sy health
507 The current health of the pool.
508 Health can be one of
509 .Sy ONLINE , DEGRADED , FAULTED , OFFLINE, REMOVED , UNAVAIL .
510 .It Sy guid
511 A unique identifier for the pool.
512 .It Sy size
513 Total size of the storage pool.
514 .It Sy unsupported@ Ns Em feature_guid
515 Information about unsupported features that are enabled on the pool.
516 See
517 .Xr zpool-features 5
518 for details.
519 .It Sy used
520 Amount of storage space used within the pool.
521 .El
522 .Pp
523 The space usage properties report actual physical space available to the
524 storage pool.
525 The physical space can be different from the total amount of space that any
526 contained datasets can actually use.
527 The amount of space used in a raidz configuration depends on the characteristics
528 of the data being written.
529 In addition, ZFS reserves some space for internal accounting that the
530 .Xr zfs 8
531 command takes into account, but the
532 .Nm
533 command does not.
534 For non-full pools of a reasonable size, these effects should be invisible.
535 For small pools, or pools that are close to being completely full, these
536 discrepancies may become more noticeable.
537 .Pp
538 The following property can be set at creation time and import time:
539 .Bl -tag -width Ds
540 .It Sy altroot
541 Alternate root directory.
542 If set, this directory is prepended to any mount points within the pool.
543 This can be used when examining an unknown pool where the mount points cannot be
544 trusted, or in an alternate boot environment, where the typical paths are not
545 valid.
546 .Sy altroot
547 is not a persistent property.
548 It is valid only while the system is up.
549 Setting
550 .Sy altroot
551 defaults to using
552 .Sy cachefile Ns = Ns Sy none ,
553 though this may be overridden using an explicit setting.
554 .El
555 .Pp
556 The following property can be set only at import time:
557 .Bl -tag -width Ds
558 .It Sy readonly Ns = Ns Sy on Ns | Ns Sy off
559 If set to
560 .Sy on ,
561 the pool will be imported in read-only mode.
562 This property can also be referred to by its shortened column name,
563 .Sy rdonly .
564 .El
565 .Pp
566 The following properties can be set at creation time and import time, and later
567 changed with the
568 .Nm zpool Cm set
569 command:
570 .Bl -tag -width Ds
571 .It Sy ashift Ns = Ns Sy ashift
572 Pool sector size exponent, to the power of
573 .Sy 2
574 (internally referred to as
575 .Sy ashift
576 ). Values from 9 to 16, inclusive, are valid; also, the special
577 value 0 (the default) means to auto-detect using the kernel's block
578 layer and a ZFS internal exception list. I/O operations will be aligned
579 to the specified size boundaries. Additionally, the minimum (disk)
580 write size will be set to the specified size, so this represents a
581 space vs. performance trade-off. For optimal performance, the pool
582 sector size should be greater than or equal to the sector size of the
583 underlying disks. The typical case for setting this property is when
584 performance is important and the underlying disks use 4KiB sectors but
585 report 512B sectors to the OS (for compatibility reasons); in that
586 case, set
587 .Sy ashift=12
588 (which is 1<<12 = 4096). When set, this property is
589 used as the default hint value in subsequent vdev operations (add,
590 attach and replace). Changing this value will not modify any existing
591 vdev, not even on disk replacement; however it can be used, for
592 instance, to replace a dying 512B sectors disk with a newer 4KiB
593 sectors device: this will probably result in bad performance but at the
594 same time could prevent loss of data.
595 .It Sy autoexpand Ns = Ns Sy on Ns | Ns Sy off
596 Controls automatic pool expansion when the underlying LUN is grown.
597 If set to
598 .Sy on ,
599 the pool will be resized according to the size of the expanded device.
600 If the device is part of a mirror or raidz then all devices within that
601 mirror/raidz group must be expanded before the new space is made available to
602 the pool.
603 The default behavior is
604 .Sy off .
605 This property can also be referred to by its shortened column name,
606 .Sy expand .
607 .It Sy autoreplace Ns = Ns Sy on Ns | Ns Sy off
608 Controls automatic device replacement.
609 If set to
610 .Sy off ,
611 device replacement must be initiated by the administrator by using the
612 .Nm zpool Cm replace
613 command.
614 If set to
615 .Sy on ,
616 any new device, found in the same physical location as a device that previously
617 belonged to the pool, is automatically formatted and replaced.
618 The default behavior is
619 .Sy off .
620 This property can also be referred to by its shortened column name,
621 .Sy replace .
622 Autoreplace can also be used with virtual disks (like device
623 mapper) provided that you use the /dev/disk/by-vdev paths setup by
624 vdev_id.conf. See the
625 .Xr vdev_id 8
626 man page for more details.
627 Autoreplace and autoonline require the ZFS Event Daemon be configured and
628 running. See the
629 .Xr zed 8
630 man page for more details.
631 .It Sy bootfs Ns = Ns Sy (unset) Ns | Ns Ar pool Ns / Ns Ar dataset
632 Identifies the default bootable dataset for the root pool. This property is
633 expected to be set mainly by the installation and upgrade programs.
634 Not all Linux distribution boot processes use the bootfs property.
635 .It Sy cachefile Ns = Ns Ar path Ns | Ns Sy none
636 Controls the location of where the pool configuration is cached.
637 Discovering all pools on system startup requires a cached copy of the
638 configuration data that is stored on the root file system.
639 All pools in this cache are automatically imported when the system boots.
640 Some environments, such as install and clustering, need to cache this
641 information in a different location so that pools are not automatically
642 imported.
643 Setting this property caches the pool configuration in a different location that
644 can later be imported with
645 .Nm zpool Cm import Fl c .
646 Setting it to the special value
647 .Sy none
648 creates a temporary pool that is never cached, and the special value
649 .Qq
650 .Pq empty string
651 uses the default location.
652 .Pp
653 Multiple pools can share the same cache file.
654 Because the kernel destroys and recreates this file when pools are added and
655 removed, care should be taken when attempting to access this file.
656 When the last pool using a
657 .Sy cachefile
658 is exported or destroyed, the file will be empty.
659 .It Sy comment Ns = Ns Ar text
660 A text string consisting of printable ASCII characters that will be stored
661 such that it is available even if the pool becomes faulted.
662 An administrator can provide additional information about a pool using this
663 property.
664 .It Sy dedupditto Ns = Ns Ar number
665 Threshold for the number of block ditto copies.
666 If the reference count for a deduplicated block increases above this number, a
667 new ditto copy of this block is automatically stored.
668 The default setting is
669 .Sy 0
670 which causes no ditto copies to be created for deduplicated blocks.
671 The minimum legal nonzero setting is
672 .Sy 100 .
673 .It Sy delegation Ns = Ns Sy on Ns | Ns Sy off
674 Controls whether a non-privileged user is granted access based on the dataset
675 permissions defined on the dataset.
676 See
677 .Xr zfs 8
678 for more information on ZFS delegated administration.
679 .It Sy failmode Ns = Ns Sy wait Ns | Ns Sy continue Ns | Ns Sy panic
680 Controls the system behavior in the event of catastrophic pool failure.
681 This condition is typically a result of a loss of connectivity to the underlying
682 storage device(s) or a failure of all devices within the pool.
683 The behavior of such an event is determined as follows:
684 .Bl -tag -width "continue"
685 .It Sy wait
686 Blocks all I/O access until the device connectivity is recovered and the errors
687 are cleared.
688 This is the default behavior.
689 .It Sy continue
690 Returns
691 .Er EIO
692 to any new write I/O requests but allows reads to any of the remaining healthy
693 devices.
694 Any write requests that have yet to be committed to disk would be blocked.
695 .It Sy panic
696 Prints out a message to the console and generates a system crash dump.
697 .El
698 .It Sy feature@ Ns Ar feature_name Ns = Ns Sy enabled
699 The value of this property is the current state of
700 .Ar feature_name .
701 The only valid value when setting this property is
702 .Sy enabled
703 which moves
704 .Ar feature_name
705 to the enabled state.
706 See
707 .Xr zpool-features 5
708 for details on feature states.
709 .It Sy listsnapshots Ns = Ns Sy on Ns | Ns Sy off
710 Controls whether information about snapshots associated with this pool is
711 output when
712 .Nm zfs Cm list
713 is run without the
714 .Fl t
715 option.
716 The default value is
717 .Sy off .
718 This property can also be referred to by its shortened name,
719 .Sy listsnaps .
720 .It Sy multihost Ns = Ns Sy on Ns | Ns Sy off
721 Controls whether a pool activity check should be performed during
722 .Nm zpool Cm import .
723 When a pool is determined to be active it cannot be imported, even with the
724 .Fl f
725 option. This property is intended to be used in failover configurations
726 where multiple hosts have access to a pool on shared storage. When this
727 property is on, periodic writes to storage occur to show the pool is in use.
728 See
729 .Sy zfs_multihost_interval
730 in the
731 .Xr zfs-module-parameters 5
732 man page. In order to enable this property each host must set a unique hostid.
733 See
734 .Xr genhostid 1
735 .Xr zgenhostid 8
736 .Xr spl-module-paramters 5
737 for additional details. The default value is
738 .Sy off .
739 .It Sy version Ns = Ns Ar version
740 The current on-disk version of the pool.
741 This can be increased, but never decreased.
742 The preferred method of updating pools is with the
743 .Nm zpool Cm upgrade
744 command, though this property can be used when a specific version is needed for
745 backwards compatibility.
746 Once feature flags are enabled on a pool this property will no longer have a
747 value.
748 .El
749 .Ss Subcommands
750 All subcommands that modify state are logged persistently to the pool in their
751 original form.
752 .Pp
753 The
754 .Nm
755 command provides subcommands to create and destroy storage pools, add capacity
756 to storage pools, and provide information about the storage pools.
757 The following subcommands are supported:
758 .Bl -tag -width Ds
759 .It Xo
760 .Nm
761 .Fl ?
762 .Xc
763 Displays a help message.
764 .It Xo
765 .Nm
766 .Cm add
767 .Op Fl fgLnP
768 .Oo Fl o Ar property Ns = Ns Ar value Oc
769 .Ar pool vdev Ns ...
770 .Xc
771 Adds the specified virtual devices to the given pool.
772 The
773 .Ar vdev
774 specification is described in the
775 .Sx Virtual Devices
776 section.
777 The behavior of the
778 .Fl f
779 option, and the device checks performed are described in the
780 .Nm zpool Cm create
781 subcommand.
782 .Bl -tag -width Ds
783 .It Fl f
784 Forces use of
785 .Ar vdev Ns s ,
786 even if they appear in use or specify a conflicting replication level.
787 Not all devices can be overridden in this manner.
788 .It Fl g
789 Display
790 .Ar vdev ,
791 GUIDs instead of the normal device names. These GUIDs can be used in place of
792 device names for the zpool detach/offline/remove/replace commands.
793 .It Fl L
794 Display real paths for
795 .Ar vdev Ns s
796 resolving all symbolic links. This can be used to look up the current block
797 device name regardless of the /dev/disk/ path used to open it.
798 .It Fl n
799 Displays the configuration that would be used without actually adding the
800 .Ar vdev Ns s .
801 The actual pool creation can still fail due to insufficient privileges or
802 device sharing.
803 .It Fl P
804 Display real paths for
805 .Ar vdev Ns s
806 instead of only the last component of the path. This can be used in
807 conjunction with the -L flag.
808 .It Fl o Ar property Ns = Ns Ar value
809 Sets the given pool properties. See the
810 .Sx Properties
811 section for a list of valid properties that can be set. The only property
812 supported at the moment is ashift.
813 .El
814 .It Xo
815 .Nm
816 .Cm attach
817 .Op Fl f
818 .Oo Fl o Ar property Ns = Ns Ar value Oc
819 .Ar pool device new_device
820 .Xc
821 Attaches
822 .Ar new_device
823 to the existing
824 .Ar device .
825 The existing device cannot be part of a raidz configuration.
826 If
827 .Ar device
828 is not currently part of a mirrored configuration,
829 .Ar device
830 automatically transforms into a two-way mirror of
831 .Ar device
832 and
833 .Ar new_device .
834 If
835 .Ar device
836 is part of a two-way mirror, attaching
837 .Ar new_device
838 creates a three-way mirror, and so on.
839 In either case,
840 .Ar new_device
841 begins to resilver immediately.
842 .Bl -tag -width Ds
843 .It Fl f
844 Forces use of
845 .Ar new_device ,
846 even if its appears to be in use.
847 Not all devices can be overridden in this manner.
848 .It Fl o Ar property Ns = Ns Ar value
849 Sets the given pool properties. See the
850 .Sx Properties
851 section for a list of valid properties that can be set. The only property
852 supported at the moment is ashift.
853 .El
854 .It Xo
855 .Nm
856 .Cm clear
857 .Ar pool
858 .Op Ar device
859 .Xc
860 Clears device errors in a pool.
861 If no arguments are specified, all device errors within the pool are cleared.
862 If one or more devices is specified, only those errors associated with the
863 specified device or devices are cleared.
864 .It Xo
865 .Nm
866 .Cm create
867 .Op Fl dfn
868 .Op Fl m Ar mountpoint
869 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
870 .Oo Fl o Ar feature@feature Ns = Ns Ar value Oc Ns ...
871 .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
872 .Op Fl R Ar root
873 .Op Fl t Ar tname
874 .Ar pool vdev Ns ...
875 .Xc
876 Creates a new storage pool containing the virtual devices specified on the
877 command line.
878 The pool name must begin with a letter, and can only contain
879 alphanumeric characters as well as underscore
880 .Pq Qq Sy _ ,
881 dash
882 .Pq Qq Sy \&- ,
883 colon
884 .Pq Qq Sy \&: ,
885 space
886 .Pq Qq Sy \&\ ,
887 and period
888 .Pq Qq Sy \&. .
889 The pool names
890 .Sy mirror ,
891 .Sy raidz ,
892 .Sy spare
893 and
894 .Sy log
895 are reserved, as are names beginning with the pattern
896 .Sy c[0-9] .
897 The
898 .Ar vdev
899 specification is described in the
900 .Sx Virtual Devices
901 section.
902 .Pp
903 The command verifies that each device specified is accessible and not currently
904 in use by another subsystem.
905 There are some uses, such as being currently mounted, or specified as the
906 dedicated dump device, that prevents a device from ever being used by ZFS.
907 Other uses, such as having a preexisting UFS file system, can be overridden with
908 the
909 .Fl f
910 option.
911 .Pp
912 The command also checks that the replication strategy for the pool is
913 consistent.
914 An attempt to combine redundant and non-redundant storage in a single pool, or
915 to mix disks and files, results in an error unless
916 .Fl f
917 is specified.
918 The use of differently sized devices within a single raidz or mirror group is
919 also flagged as an error unless
920 .Fl f
921 is specified.
922 .Pp
923 Unless the
924 .Fl R
925 option is specified, the default mount point is
926 .Pa / Ns Ar pool .
927 The mount point must not exist or must be empty, or else the root dataset
928 cannot be mounted.
929 This can be overridden with the
930 .Fl m
931 option.
932 .Pp
933 By default all supported features are enabled on the new pool unless the
934 .Fl d
935 option is specified.
936 .Bl -tag -width Ds
937 .It Fl d
938 Do not enable any features on the new pool.
939 Individual features can be enabled by setting their corresponding properties to
940 .Sy enabled
941 with the
942 .Fl o
943 option.
944 See
945 .Xr zpool-features 5
946 for details about feature properties.
947 .It Fl f
948 Forces use of
949 .Ar vdev Ns s ,
950 even if they appear in use or specify a conflicting replication level.
951 Not all devices can be overridden in this manner.
952 .It Fl m Ar mountpoint
953 Sets the mount point for the root dataset.
954 The default mount point is
955 .Pa /pool
956 or
957 .Pa altroot/pool
958 if
959 .Ar altroot
960 is specified.
961 The mount point must be an absolute path,
962 .Sy legacy ,
963 or
964 .Sy none .
965 For more information on dataset mount points, see
966 .Xr zfs 8 .
967 .It Fl n
968 Displays the configuration that would be used without actually creating the
969 pool.
970 The actual pool creation can still fail due to insufficient privileges or
971 device sharing.
972 .It Fl o Ar property Ns = Ns Ar value
973 Sets the given pool properties.
974 See the
975 .Sx Properties
976 section for a list of valid properties that can be set.
977 .It Fl o Ar feature@feature Ns = Ns Ar value
978 Sets the given pool feature. See the
979 .Xr zpool-features 5
980 section for a list of valid features that can be set.
981 Value can be either disabled or enabled.
982 .It Fl O Ar file-system-property Ns = Ns Ar value
983 Sets the given file system properties in the root file system of the pool.
984 See the
985 .Sx Properties
986 section of
987 .Xr zfs 8
988 for a list of valid properties that can be set.
989 .It Fl R Ar root
990 Equivalent to
991 .Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
992 .It Fl t Ar tname
993 Sets the in-core pool name to
994 .Sy tname
995 while the on-disk name will be the name specified as the pool name
996 .Sy pool .
997 This will set the default cachefile property to none. This is intended
998 to handle name space collisions when creating pools for other systems,
999 such as virtual machines or physical machines whose pools live on network
1000 block devices.
1001 .El
1002 .It Xo
1003 .Nm
1004 .Cm destroy
1005 .Op Fl f
1006 .Ar pool
1007 .Xc
1008 Destroys the given pool, freeing up any devices for other use.
1009 This command tries to unmount any active datasets before destroying the pool.
1010 .Bl -tag -width Ds
1011 .It Fl f
1012 Forces any active datasets contained within the pool to be unmounted.
1013 .El
1014 .It Xo
1015 .Nm
1016 .Cm detach
1017 .Ar pool device
1018 .Xc
1019 Detaches
1020 .Ar device
1021 from a mirror.
1022 The operation is refused if there are no other valid replicas of the data.
1023 If device may be re-added to the pool later on then consider the
1024 .Sy zpool offline
1025 command instead.
1026 .It Xo
1027 .Nm
1028 .Cm events
1029 .Op Fl vHf Oo Ar pool Oc | Fl c
1030 .Xc
1031 Lists all recent events generated by the ZFS kernel modules. These events
1032 are consumed by the
1033 .Xr zed 8
1034 and used to automate administrative tasks such as replacing a failed device
1035 with a hot spare. For more information about the subclasses and event payloads
1036 that can be generated see the
1037 .Xr zfs-events 5
1038 man page.
1039 .Bl -tag -width Ds
1040 .It Fl c
1041 Clear all previous events.
1042 .It Fl f
1043 Follow mode.
1044 .It Fl H
1045 Scripted mode. Do not display headers, and separate fields by a
1046 single tab instead of arbitrary space.
1047 .It Fl v
1048 Print the entire payload for each event.
1049 .El
1050 .It Xo
1051 .Nm
1052 .Cm export
1053 .Op Fl a
1054 .Op Fl f
1055 .Ar pool Ns ...
1056 .Xc
1057 Exports the given pools from the system.
1058 All devices are marked as exported, but are still considered in use by other
1059 subsystems.
1060 The devices can be moved between systems
1061 .Pq even those of different endianness
1062 and imported as long as a sufficient number of devices are present.
1063 .Pp
1064 Before exporting the pool, all datasets within the pool are unmounted.
1065 A pool can not be exported if it has a shared spare that is currently being
1066 used.
1067 .Pp
1068 For pools to be portable, you must give the
1069 .Nm
1070 command whole disks, not just partitions, so that ZFS can label the disks with
1071 portable EFI labels.
1072 Otherwise, disk drivers on platforms of different endianness will not recognize
1073 the disks.
1074 .Bl -tag -width Ds
1075 .It Fl a
1076 Exports all pools imported on the system.
1077 .It Fl f
1078 Forcefully unmount all datasets, using the
1079 .Nm unmount Fl f
1080 command.
1081 .Pp
1082 This command will forcefully export the pool even if it has a shared spare that
1083 is currently being used.
1084 This may lead to potential data corruption.
1085 .El
1086 .It Xo
1087 .Nm
1088 .Cm get
1089 .Op Fl Hp
1090 .Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
1091 .Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
1092 .Ar pool Ns ...
1093 .Xc
1094 Retrieves the given list of properties
1095 .Po
1096 or all properties if
1097 .Sy all
1098 is used
1099 .Pc
1100 for the specified storage pool(s).
1101 These properties are displayed with the following fields:
1102 .Bd -literal
1103 name Name of storage pool
1104 property Property name
1105 value Property value
1106 source Property source, either 'default' or 'local'.
1107 .Ed
1108 .Pp
1109 See the
1110 .Sx Properties
1111 section for more information on the available pool properties.
1112 .Bl -tag -width Ds
1113 .It Fl H
1114 Scripted mode.
1115 Do not display headers, and separate fields by a single tab instead of arbitrary
1116 space.
1117 .It Fl o Ar field
1118 A comma-separated list of columns to display.
1119 .Sy name Ns \&, Ns Sy property Ns \&, Ns Sy value Ns \&, Ns Sy source
1120 is the default value.
1121 .It Fl p
1122 Display numbers in parsable (exact) values.
1123 .El
1124 .It Xo
1125 .Nm
1126 .Cm history
1127 .Op Fl il
1128 .Oo Ar pool Oc Ns ...
1129 .Xc
1130 Displays the command history of the specified pool(s) or all pools if no pool is
1131 specified.
1132 .Bl -tag -width Ds
1133 .It Fl i
1134 Displays internally logged ZFS events in addition to user initiated events.
1135 .It Fl l
1136 Displays log records in long format, which in addition to standard format
1137 includes, the user name, the hostname, and the zone in which the operation was
1138 performed.
1139 .El
1140 .It Xo
1141 .Nm
1142 .Cm import
1143 .Op Fl D
1144 .Op Fl d Ar dir
1145 .Xc
1146 Lists pools available to import.
1147 If the
1148 .Fl d
1149 option is not specified, this command searches for devices in
1150 .Pa /dev .
1151 The
1152 .Fl d
1153 option can be specified multiple times, and all directories are searched.
1154 If the device appears to be part of an exported pool, this command displays a
1155 summary of the pool with the name of the pool, a numeric identifier, as well as
1156 the vdev layout and current health of the device for each device or file.
1157 Destroyed pools, pools that were previously destroyed with the
1158 .Nm zpool Cm destroy
1159 command, are not listed unless the
1160 .Fl D
1161 option is specified.
1162 .Pp
1163 The numeric identifier is unique, and can be used instead of the pool name when
1164 multiple exported pools of the same name are available.
1165 .Bl -tag -width Ds
1166 .It Fl c Ar cachefile
1167 Reads configuration from the given
1168 .Ar cachefile
1169 that was created with the
1170 .Sy cachefile
1171 pool property.
1172 This
1173 .Ar cachefile
1174 is used instead of searching for devices.
1175 .It Fl d Ar dir
1176 Searches for devices or files in
1177 .Ar dir .
1178 The
1179 .Fl d
1180 option can be specified multiple times.
1181 .It Fl D
1182 Lists destroyed pools only.
1183 .El
1184 .It Xo
1185 .Nm
1186 .Cm import
1187 .Fl a
1188 .Op Fl DflmN
1189 .Op Fl F Oo Fl n Oc Oo Fl T Oc Oo Fl X Oc
1190 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1191 .Op Fl o Ar mntopts
1192 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1193 .Op Fl R Ar root
1194 .Op Fl s
1195 .Xc
1196 Imports all pools found in the search directories.
1197 Identical to the previous command, except that all pools with a sufficient
1198 number of devices available are imported.
1199 Destroyed pools, pools that were previously destroyed with the
1200 .Nm zpool Cm destroy
1201 command, will not be imported unless the
1202 .Fl D
1203 option is specified.
1204 .Bl -tag -width Ds
1205 .It Fl a
1206 Searches for and imports all pools found.
1207 .It Fl c Ar cachefile
1208 Reads configuration from the given
1209 .Ar cachefile
1210 that was created with the
1211 .Sy cachefile
1212 pool property.
1213 This
1214 .Ar cachefile
1215 is used instead of searching for devices.
1216 .It Fl d Ar dir
1217 Searches for devices or files in
1218 .Ar dir .
1219 The
1220 .Fl d
1221 option can be specified multiple times.
1222 This option is incompatible with the
1223 .Fl c
1224 option.
1225 .It Fl D
1226 Imports destroyed pools only.
1227 The
1228 .Fl f
1229 option is also required.
1230 .It Fl f
1231 Forces import, even if the pool appears to be potentially active.
1232 .It Fl F
1233 Recovery mode for a non-importable pool.
1234 Attempt to return the pool to an importable state by discarding the last few
1235 transactions.
1236 Not all damaged pools can be recovered by using this option.
1237 If successful, the data from the discarded transactions is irretrievably lost.
1238 This option is ignored if the pool is importable or already imported.
1239 .It Fl l
1240 Indicates that this command will request encryption keys for all encrypted
1241 datasets it attempts to mount as it is bringing the pool online. Note that if
1242 any datasets have a
1243 .Sy keylocation
1244 of
1245 .Sy prompt
1246 this command will block waiting for the keys to be entered. Without this flag
1247 encrypted datasets will be left unavailable until the keys are loaded.
1248 .It Fl m
1249 Allows a pool to import when there is a missing log device.
1250 Recent transactions can be lost because the log device will be discarded.
1251 .It Fl n
1252 Used with the
1253 .Fl F
1254 recovery option.
1255 Determines whether a non-importable pool can be made importable again, but does
1256 not actually perform the pool recovery.
1257 For more details about pool recovery mode, see the
1258 .Fl F
1259 option, above.
1260 .It Fl N
1261 Import the pool without mounting any file systems.
1262 .It Fl o Ar mntopts
1263 Comma-separated list of mount options to use when mounting datasets within the
1264 pool.
1265 See
1266 .Xr zfs 8
1267 for a description of dataset properties and mount options.
1268 .It Fl o Ar property Ns = Ns Ar value
1269 Sets the specified property on the imported pool.
1270 See the
1271 .Sx Properties
1272 section for more information on the available pool properties.
1273 .It Fl R Ar root
1274 Sets the
1275 .Sy cachefile
1276 property to
1277 .Sy none
1278 and the
1279 .Sy altroot
1280 property to
1281 .Ar root .
1282 .It Fl s
1283 Scan using the default search path, the libblkid cache will not be
1284 consulted. A custom search path may be specified by setting the
1285 ZPOOL_IMPORT_PATH environment variable.
1286 .It Fl X
1287 Used with the
1288 .Fl F
1289 recovery option. Determines whether extreme
1290 measures to find a valid txg should take place. This allows the pool to
1291 be rolled back to a txg which is no longer guaranteed to be consistent.
1292 Pools imported at an inconsistent txg may contain uncorrectable
1293 checksum errors. For more details about pool recovery mode, see the
1294 .Fl F
1295 option, above. WARNING: This option can be extremely hazardous to the
1296 health of your pool and should only be used as a last resort.
1297 .It Fl T
1298 Specify the txg to use for rollback. Implies
1299 .Fl FX .
1300 For more details
1301 about pool recovery mode, see the
1302 .Fl X
1303 option, above. WARNING: This option can be extremely hazardous to the
1304 health of your pool and should only be used as a last resort.
1305 .El
1306 .It Xo
1307 .Nm
1308 .Cm import
1309 .Op Fl Dflm
1310 .Op Fl F Oo Fl n Oc Oo Fl t Oc Oo Fl T Oc Oo Fl X Oc
1311 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1312 .Op Fl o Ar mntopts
1313 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1314 .Op Fl R Ar root
1315 .Op Fl s
1316 .Ar pool Ns | Ns Ar id
1317 .Op Ar newpool
1318 .Xc
1319 Imports a specific pool.
1320 A pool can be identified by its name or the numeric identifier.
1321 If
1322 .Ar newpool
1323 is specified, the pool is imported using the name
1324 .Ar newpool .
1325 Otherwise, it is imported with the same name as its exported name.
1326 .Pp
1327 If a device is removed from a system without running
1328 .Nm zpool Cm export
1329 first, the device appears as potentially active.
1330 It cannot be determined if this was a failed export, or whether the device is
1331 really in use from another host.
1332 To import a pool in this state, the
1333 .Fl f
1334 option is required.
1335 .Bl -tag -width Ds
1336 .It Fl c Ar cachefile
1337 Reads configuration from the given
1338 .Ar cachefile
1339 that was created with the
1340 .Sy cachefile
1341 pool property.
1342 This
1343 .Ar cachefile
1344 is used instead of searching for devices.
1345 .It Fl d Ar dir
1346 Searches for devices or files in
1347 .Ar dir .
1348 The
1349 .Fl d
1350 option can be specified multiple times.
1351 This option is incompatible with the
1352 .Fl c
1353 option.
1354 .It Fl D
1355 Imports destroyed pool.
1356 The
1357 .Fl f
1358 option is also required.
1359 .It Fl f
1360 Forces import, even if the pool appears to be potentially active.
1361 .It Fl F
1362 Recovery mode for a non-importable pool.
1363 Attempt to return the pool to an importable state by discarding the last few
1364 transactions.
1365 Not all damaged pools can be recovered by using this option.
1366 If successful, the data from the discarded transactions is irretrievably lost.
1367 This option is ignored if the pool is importable or already imported.
1368 .It Fl l
1369 Indicates that this command will request encryption keys for all encrypted
1370 datasets it attempts to mount as it is bringing the pool online. Note that if
1371 any datasets have a
1372 .Sy keylocation
1373 of
1374 .Sy prompt
1375 this command will block waiting for the keys to be entered. Without this flag
1376 encrypted datasets will be left unavailable until the keys are loaded.
1377 .It Fl m
1378 Allows a pool to import when there is a missing log device.
1379 Recent transactions can be lost because the log device will be discarded.
1380 .It Fl n
1381 Used with the
1382 .Fl F
1383 recovery option.
1384 Determines whether a non-importable pool can be made importable again, but does
1385 not actually perform the pool recovery.
1386 For more details about pool recovery mode, see the
1387 .Fl F
1388 option, above.
1389 .It Fl o Ar mntopts
1390 Comma-separated list of mount options to use when mounting datasets within the
1391 pool.
1392 See
1393 .Xr zfs 8
1394 for a description of dataset properties and mount options.
1395 .It Fl o Ar property Ns = Ns Ar value
1396 Sets the specified property on the imported pool.
1397 See the
1398 .Sx Properties
1399 section for more information on the available pool properties.
1400 .It Fl R Ar root
1401 Sets the
1402 .Sy cachefile
1403 property to
1404 .Sy none
1405 and the
1406 .Sy altroot
1407 property to
1408 .Ar root .
1409 .It Fl s
1410 Scan using the default search path, the libblkid cache will not be
1411 consulted. A custom search path may be specified by setting the
1412 ZPOOL_IMPORT_PATH environment variable.
1413 .It Fl X
1414 Used with the
1415 .Fl F
1416 recovery option. Determines whether extreme
1417 measures to find a valid txg should take place. This allows the pool to
1418 be rolled back to a txg which is no longer guaranteed to be consistent.
1419 Pools imported at an inconsistent txg may contain uncorrectable
1420 checksum errors. For more details about pool recovery mode, see the
1421 .Fl F
1422 option, above. WARNING: This option can be extremely hazardous to the
1423 health of your pool and should only be used as a last resort.
1424 .It Fl T
1425 Specify the txg to use for rollback. Implies
1426 .Fl FX .
1427 For more details
1428 about pool recovery mode, see the
1429 .Fl X
1430 option, above. WARNING: This option can be extremely hazardous to the
1431 health of your pool and should only be used as a last resort.
1432 .It Fl s
1433 Used with
1434 .Sy newpool .
1435 Specifies that
1436 .Sy newpool
1437 is temporary. Temporary pool names last until export. Ensures that
1438 the original pool name will be used in all label updates and therefore
1439 is retained upon export.
1440 Will also set -o cachefile=none when not explicitly specified.
1441 .El
1442 .It Xo
1443 .Nm
1444 .Cm iostat
1445 .Op Oo Oo Fl c Ar SCRIPT Oc Oo Fl lq Oc Oc Ns | Ns Fl rw
1446 .Op Fl T Sy u Ns | Ns Sy d
1447 .Op Fl ghHLpPvy
1448 .Oo Oo Ar pool Ns ... Oc Ns | Ns Oo Ar pool vdev Ns ... Oc Ns | Ns Oo Ar vdev Ns ... Oc Oc
1449 .Op Ar interval Op Ar count
1450 .Xc
1451 Displays I/O statistics for the given pools/vdevs. You can pass in a
1452 list of pools, a pool and list of vdevs in that pool, or a list of any
1453 vdevs from any pool. If no items are specified, statistics for every
1454 pool in the system are shown.
1455 When given an
1456 .Ar interval ,
1457 the statistics are printed every
1458 .Ar interval
1459 seconds until ^C is pressed. If count is specified, the command exits
1460 after count reports are printed. The first report printed is always
1461 the statistics since boot regardless of whether
1462 .Ar interval
1463 and
1464 .Ar count
1465 are passed. However, this behavior can be suppressed with the
1466 .Fl y
1467 flag. Also note that the units of
1468 .Sy K ,
1469 .Sy M ,
1470 .Sy G ...
1471 that are printed in the report are in base 1024. To get the raw
1472 values, use the
1473 .Fl p
1474 flag.
1475 .Bl -tag -width Ds
1476 .It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
1477 Run a script (or scripts) on each vdev and include the output as a new column
1478 in the
1479 .Nm zpool Cm iostat
1480 output. Users can run any script found in their
1481 .Pa ~/.zpool.d
1482 directory or from the system
1483 .Pa /etc/zfs/zpool.d
1484 directory. Script names containing the slash (/) character are not allowed.
1485 The default search path can be overridden by setting the
1486 ZPOOL_SCRIPTS_PATH environment variable. A privileged user can run
1487 .Fl c
1488 if they have the ZPOOL_SCRIPTS_AS_ROOT
1489 environment variable set. If a script requires the use of a privileged
1490 command, like
1491 .Xr smartctl 8 ,
1492 then it's recommended you allow the user access to it in
1493 .Pa /etc/sudoers
1494 or add the user to the
1495 .Pa /etc/sudoers.d/zfs
1496 file.
1497 .Pp
1498 If
1499 .Fl c
1500 is passed without a script name, it prints a list of all scripts.
1501 .Fl c
1502 also sets verbose mode
1503 .No \&( Ns Fl v Ns No \&).
1504 .Pp
1505 Script output should be in the form of "name=value". The column name is
1506 set to "name" and the value is set to "value". Multiple lines can be
1507 used to output multiple columns. The first line of output not in the
1508 "name=value" format is displayed without a column title, and no more
1509 output after that is displayed. This can be useful for printing error
1510 messages. Blank or NULL values are printed as a '-' to make output
1511 awk-able.
1512 .Pp
1513 The following environment variables are set before running each script:
1514 .Bl -tag -width "VDEV_PATH"
1515 .It Sy VDEV_PATH
1516 Full path to the vdev
1517 .El
1518 .Bl -tag -width "VDEV_UPATH"
1519 .It Sy VDEV_UPATH
1520 Underlying path to the vdev (/dev/sd*). For use with device mapper,
1521 multipath, or partitioned vdevs.
1522 .El
1523 .Bl -tag -width "VDEV_ENC_SYSFS_PATH"
1524 .It Sy VDEV_ENC_SYSFS_PATH
1525 The sysfs path to the enclosure for the vdev (if any).
1526 .El
1527 .It Fl T Sy u Ns | Ns Sy d
1528 Display a time stamp.
1529 Specify
1530 .Sy u
1531 for a printed representation of the internal representation of time.
1532 See
1533 .Xr time 2 .
1534 Specify
1535 .Sy d
1536 for standard date format.
1537 See
1538 .Xr date 1 .
1539 .It Fl g
1540 Display vdev GUIDs instead of the normal device names. These GUIDs
1541 can be used in place of device names for the zpool
1542 detach/offline/remove/replace commands.
1543 .It Fl H
1544 Scripted mode. Do not display headers, and separate fields by a
1545 single tab instead of arbitrary space.
1546 .It Fl L
1547 Display real paths for vdevs resolving all symbolic links. This can
1548 be used to look up the current block device name regardless of the
1549 .Pa /dev/disk/
1550 path used to open it.
1551 .It Fl p
1552 Display numbers in parsable (exact) values. Time values are in
1553 nanoseconds.
1554 .It Fl P
1555 Display full paths for vdevs instead of only the last component of
1556 the path. This can be used in conjunction with the
1557 .Fl L
1558 flag.
1559 .It Fl r
1560 Print request size histograms for the leaf ZIOs. This includes
1561 histograms of individual ZIOs (
1562 .Ar ind )
1563 and aggregate ZIOs (
1564 .Ar agg ).
1565 These stats can be useful for seeing how well the ZFS IO aggregator is
1566 working. Do not confuse these request size stats with the block layer
1567 requests; it's possible ZIOs can be broken up before being sent to the
1568 block device.
1569 .It Fl v
1570 Verbose statistics Reports usage statistics for individual vdevs within the
1571 pool, in addition to the pool-wide statistics.
1572 .It Fl y
1573 .It Fl w
1574 .It Fl l
1575 Include average latency statistics:
1576 .Pp
1577 .Ar total_wait :
1578 Average total IO time (queuing + disk IO time).
1579 .Ar disk_wait :
1580 Average disk IO time (time reading/writing the disk).
1581 .Ar syncq_wait :
1582 Average amount of time IO spent in synchronous priority queues. Does
1583 not include disk time.
1584 .Ar asyncq_wait :
1585 Average amount of time IO spent in asynchronous priority queues.
1586 Does not include disk time.
1587 .Ar scrub :
1588 Average queuing time in scrub queue. Does not include disk time.
1589 .It Fl q
1590 Include active queue statistics. Each priority queue has both
1591 pending (
1592 .Ar pend )
1593 and active (
1594 .Ar activ )
1595 IOs. Pending IOs are waiting to
1596 be issued to the disk, and active IOs have been issued to disk and are
1597 waiting for completion. These stats are broken out by priority queue:
1598 .Pp
1599 .Ar syncq_read/write :
1600 Current number of entries in synchronous priority
1601 queues.
1602 .Ar asyncq_read/write :
1603 Current number of entries in asynchronous priority queues.
1604 .Ar scrubq_read :
1605 Current number of entries in scrub queue.
1606 .Pp
1607 All queue statistics are instantaneous measurements of the number of
1608 entries in the queues. If you specify an interval, the measurements
1609 will be sampled from the end of the interval.
1610 .El
1611 .It Xo
1612 .Nm
1613 .Cm labelclear
1614 .Op Fl f
1615 .Ar device
1616 .Xc
1617 Removes ZFS label information from the specified
1618 .Ar device .
1619 The
1620 .Ar device
1621 must not be part of an active pool configuration.
1622 .Bl -tag -width Ds
1623 .It Fl f
1624 Treat exported or foreign devices as inactive.
1625 .El
1626 .It Xo
1627 .Nm
1628 .Cm list
1629 .Op Fl HgLpPv
1630 .Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
1631 .Op Fl T Sy u Ns | Ns Sy d
1632 .Oo Ar pool Oc Ns ...
1633 .Op Ar interval Op Ar count
1634 .Xc
1635 Lists the given pools along with a health status and space usage.
1636 If no
1637 .Ar pool Ns s
1638 are specified, all pools in the system are listed.
1639 When given an
1640 .Ar interval ,
1641 the information is printed every
1642 .Ar interval
1643 seconds until ^C is pressed.
1644 If
1645 .Ar count
1646 is specified, the command exits after
1647 .Ar count
1648 reports are printed.
1649 .Bl -tag -width Ds
1650 .It Fl g
1651 Display vdev GUIDs instead of the normal device names. These GUIDs
1652 can be used in place of device names for the zpool
1653 detach/offline/remove/replace commands.
1654 .It Fl H
1655 Scripted mode.
1656 Do not display headers, and separate fields by a single tab instead of arbitrary
1657 space.
1658 .It Fl o Ar property
1659 Comma-separated list of properties to display.
1660 See the
1661 .Sx Properties
1662 section for a list of valid properties.
1663 The default list is
1664 .Sy name, size, alloc, free, fragmentation, expandsize, capacity,
1665 .Sy dedupratio, health, altroot .
1666 .It Fl L
1667 Display real paths for vdevs resolving all symbolic links. This can
1668 be used to look up the current block device name regardless of the
1669 /dev/disk/ path used to open it.
1670 .It Fl p
1671 Display numbers in parsable
1672 .Pq exact
1673 values.
1674 .It Fl P
1675 Display full paths for vdevs instead of only the last component of
1676 the path. This can be used in conjunction with the
1677 .Fl L flag.
1678 .It Fl T Sy u Ns | Ns Sy d
1679 Display a time stamp.
1680 Specify
1681 .Fl u
1682 for a printed representation of the internal representation of time.
1683 See
1684 .Xr time 2 .
1685 Specify
1686 .Fl d
1687 for standard date format.
1688 See
1689 .Xr date 1 .
1690 .It Fl v
1691 Verbose statistics.
1692 Reports usage statistics for individual vdevs within the pool, in addition to
1693 the pool-wise statistics.
1694 .El
1695 .It Xo
1696 .Nm
1697 .Cm offline
1698 .Op Fl f
1699 .Op Fl t
1700 .Ar pool Ar device Ns ...
1701 .Xc
1702 Takes the specified physical device offline.
1703 While the
1704 .Ar device
1705 is offline, no attempt is made to read or write to the device.
1706 This command is not applicable to spares.
1707 .Bl -tag -width Ds
1708 .It Fl f
1709 Force fault. Instead of offlining the disk, put it into a faulted
1710 state. The fault will persist across imports unless the
1711 .Fl t
1712 flag was specified.
1713 .It Fl t
1714 Temporary.
1715 Upon reboot, the specified physical device reverts to its previous state.
1716 .El
1717 .It Xo
1718 .Nm
1719 .Cm online
1720 .Op Fl e
1721 .Ar pool Ar device Ns ...
1722 .Xc
1723 Brings the specified physical device online.
1724 This command is not applicable to spares.
1725 .Bl -tag -width Ds
1726 .It Fl e
1727 Expand the device to use all available space.
1728 If the device is part of a mirror or raidz then all devices must be expanded
1729 before the new space will become available to the pool.
1730 .El
1731 .It Xo
1732 .Nm
1733 .Cm reguid
1734 .Ar pool
1735 .Xc
1736 Generates a new unique identifier for the pool.
1737 You must ensure that all devices in this pool are online and healthy before
1738 performing this action.
1739 .It Xo
1740 .Nm
1741 .Cm reopen
1742 .Op Fl n
1743 .Ar pool
1744 .Xc
1745 Reopen all the vdevs associated with the pool.
1746 .Bl -tag -width Ds
1747 .It Fl n
1748 Do not restart an in-progress scrub operation. This is not recommended and can
1749 result in partially resilvered devices unless a second scrub is performed.
1750 .It Xo
1751 .Nm
1752 .Cm remove
1753 .Ar pool Ar device Ns ...
1754 .Xc
1755 Removes the specified device from the pool.
1756 This command currently only supports removing hot spares, cache, and log
1757 devices.
1758 A mirrored log device can be removed by specifying the top-level mirror for the
1759 log.
1760 Non-log devices that are part of a mirrored configuration can be removed using
1761 the
1762 .Nm zpool Cm detach
1763 command.
1764 Non-redundant and raidz devices cannot be removed from a pool.
1765 .It Xo
1766 .Nm
1767 .Cm replace
1768 .Op Fl f
1769 .Op Fl o Ar property Ns = Ns Ar value
1770 .Ar pool Ar device Op Ar new_device
1771 .Xc
1772 Replaces
1773 .Ar old_device
1774 with
1775 .Ar new_device .
1776 This is equivalent to attaching
1777 .Ar new_device ,
1778 waiting for it to resilver, and then detaching
1779 .Ar old_device .
1780 .Pp
1781 The size of
1782 .Ar new_device
1783 must be greater than or equal to the minimum size of all the devices in a mirror
1784 or raidz configuration.
1785 .Pp
1786 .Ar new_device
1787 is required if the pool is not redundant.
1788 If
1789 .Ar new_device
1790 is not specified, it defaults to
1791 .Ar old_device .
1792 This form of replacement is useful after an existing disk has failed and has
1793 been physically replaced.
1794 In this case, the new disk may have the same
1795 .Pa /dev
1796 path as the old device, even though it is actually a different disk.
1797 ZFS recognizes this.
1798 .Bl -tag -width Ds
1799 .It Fl f
1800 Forces use of
1801 .Ar new_device ,
1802 even if its appears to be in use.
1803 Not all devices can be overridden in this manner.
1804 .It Fl o Ar property Ns = Ns Ar value
1805 Sets the given pool properties. See the
1806 .Sx Properties
1807 section for a list of valid properties that can be set.
1808 The only property supported at the moment is
1809 .Sy ashift .
1810 .El
1811 .It Xo
1812 .Nm
1813 .Cm scrub
1814 .Op Fl s | Fl p
1815 .Ar pool Ns ...
1816 .Xc
1817 Begins a scrub or resumes a paused scrub.
1818 The scrub examines all data in the specified pools to verify that it checksums
1819 correctly.
1820 For replicated
1821 .Pq mirror or raidz
1822 devices, ZFS automatically repairs any damage discovered during the scrub.
1823 The
1824 .Nm zpool Cm status
1825 command reports the progress of the scrub and summarizes the results of the
1826 scrub upon completion.
1827 .Pp
1828 Scrubbing and resilvering are very similar operations.
1829 The difference is that resilvering only examines data that ZFS knows to be out
1830 of date
1831 .Po
1832 for example, when attaching a new device to a mirror or replacing an existing
1833 device
1834 .Pc ,
1835 whereas scrubbing examines all data to discover silent errors due to hardware
1836 faults or disk failure.
1837 .Pp
1838 Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows
1839 one at a time.
1840 If a scrub is paused, the
1841 .Nm zpool Cm scrub
1842 resumes it.
1843 If a resilver is in progress, ZFS does not allow a scrub to be started until the
1844 resilver completes.
1845 .Bl -tag -width Ds
1846 .It Fl s
1847 Stop scrubbing.
1848 .El
1849 .Bl -tag -width Ds
1850 .It Fl p
1851 Pause scrubbing.
1852 Scrub pause state and progress are periodically synced to disk.
1853 If the system is restarted or pool is exported during a paused scrub,
1854 even after import, scrub will remain paused until it is resumed.
1855 Once resumed the scrub will pick up from the place where it was last
1856 checkpointed to disk.
1857 To resume a paused scrub issue
1858 .Nm zpool Cm scrub
1859 again.
1860 .El
1861 .It Xo
1862 .Nm
1863 .Cm set
1864 .Ar property Ns = Ns Ar value
1865 .Ar pool
1866 .Xc
1867 Sets the given property on the specified pool.
1868 See the
1869 .Sx Properties
1870 section for more information on what properties can be set and acceptable
1871 values.
1872 .It Xo
1873 .Nm
1874 .Cm split
1875 .Op Fl gLlnP
1876 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1877 .Op Fl R Ar root
1878 .Ar pool newpool
1879 .Op Ar device ...
1880 .Xc
1881 Splits devices off
1882 .Ar pool
1883 creating
1884 .Ar newpool .
1885 All vdevs in
1886 .Ar pool
1887 must be mirrors and the pool must not be in the process of resilvering.
1888 At the time of the split,
1889 .Ar newpool
1890 will be a replica of
1891 .Ar pool .
1892 By default, the
1893 last device in each mirror is split from
1894 .Ar pool
1895 to create
1896 .Ar newpool .
1897 .Pp
1898 The optional device specification causes the specified device(s) to be
1899 included in the new
1900 .Ar pool
1901 and, should any devices remain unspecified,
1902 the last device in each mirror is used as would be by default.
1903 .Bl -tag -width Ds
1904 .It Fl g
1905 Display vdev GUIDs instead of the normal device names. These GUIDs
1906 can be used in place of device names for the zpool
1907 detach/offline/remove/replace commands.
1908 .It Fl L
1909 Display real paths for vdevs resolving all symbolic links. This can
1910 be used to look up the current block device name regardless of the
1911 .Pa /dev/disk/
1912 path used to open it.
1913 .It Fl l
1914 Indicates that this command will request encryption keys for all encrypted
1915 datasets it attempts to mount as it is bringing the new pool online. Note that
1916 if any datasets have a
1917 .Sy keylocation
1918 of
1919 .Sy prompt
1920 this command will block waiting for the keys to be entered. Without this flag
1921 encrypted datasets will be left unavailable until the keys are loaded.
1922 .It Fl n
1923 Do dry run, do not actually perform the split.
1924 Print out the expected configuration of
1925 .Ar newpool .
1926 .It Fl P
1927 Display full paths for vdevs instead of only the last component of
1928 the path. This can be used in conjunction with the
1929 .Fl L flag.
1930 .It Fl o Ar property Ns = Ns Ar value
1931 Sets the specified property for
1932 .Ar newpool .
1933 See the
1934 .Sx Properties
1935 section for more information on the available pool properties.
1936 .It Fl R Ar root
1937 Set
1938 .Sy altroot
1939 for
1940 .Ar newpool
1941 to
1942 .Ar root
1943 and automatically import it.
1944 .El
1945 .It Xo
1946 .Nm
1947 .Cm status
1948 .Op Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
1949 .Op Fl gLPvxD
1950 .Op Fl T Sy u Ns | Ns Sy d
1951 .Oo Ar pool Oc Ns ...
1952 .Op Ar interval Op Ar count
1953 .Xc
1954 Displays the detailed health status for the given pools.
1955 If no
1956 .Ar pool
1957 is specified, then the status of each pool in the system is displayed.
1958 For more information on pool and device health, see the
1959 .Sx Device Failure and Recovery
1960 section.
1961 .Pp
1962 If a scrub or resilver is in progress, this command reports the percentage done
1963 and the estimated time to completion.
1964 Both of these are only approximate, because the amount of data in the pool and
1965 the other workloads on the system can change.
1966 .Bl -tag -width Ds
1967 .It Fl c Op Ar SCRIPT1 Ns Oo , Ns Ar SCRIPT2 Oc Ns ...
1968 Run a script (or scripts) on each vdev and include the output as a new column
1969 in the
1970 .Nm zpool Cm status
1971 output. See the
1972 .Fl c
1973 option of
1974 .Nm zpool Cm iostat
1975 for complete details.
1976 .It Fl g
1977 Display vdev GUIDs instead of the normal device names. These GUIDs
1978 can be used in place of device names for the zpool
1979 detach/offline/remove/replace commands.
1980 .It Fl L
1981 Display real paths for vdevs resolving all symbolic links. This can
1982 be used to look up the current block device name regardless of the
1983 .Pa /dev/disk/
1984 path used to open it.
1985 .It Fl p
1986 Display numbers in parsable (exact) values. Time values are in
1987 nanoseconds.
1988 .It Fl D
1989 Display a histogram of deduplication statistics, showing the allocated
1990 .Pq physically present on disk
1991 and referenced
1992 .Pq logically referenced in the pool
1993 block counts and sizes by reference count.
1994 .It Fl T Sy u Ns | Ns Sy d
1995 Display a time stamp.
1996 Specify
1997 .Fl u
1998 for a printed representation of the internal representation of time.
1999 See
2000 .Xr time 2 .
2001 Specify
2002 .Fl d
2003 for standard date format.
2004 See
2005 .Xr date 1 .
2006 .It Fl v
2007 Displays verbose data error information, printing out a complete list of all
2008 data errors since the last complete pool scrub.
2009 .It Fl x
2010 Only display status for pools that are exhibiting errors or are otherwise
2011 unavailable.
2012 Warnings about pools not using the latest on-disk format will not be included.
2013 .El
2014 .It Xo
2015 .Nm
2016 .Cm sync
2017 .Op Ar pool ...
2018 .Xc
2019 This command forces all in-core dirty data to be written to the primary
2020 pool storage and not the ZIL. It will also update administrative
2021 information including quota reporting. Without arguments,
2022 .Sy zpool sync
2023 will sync all pools on the system. Otherwise, it will sync only the
2024 specified pool(s).
2025 .It Xo
2026 .Nm
2027 .Cm upgrade
2028 .Xc
2029 Displays pools which do not have all supported features enabled and pools
2030 formatted using a legacy ZFS version number.
2031 These pools can continue to be used, but some features may not be available.
2032 Use
2033 .Nm zpool Cm upgrade Fl a
2034 to enable all features on all pools.
2035 .It Xo
2036 .Nm
2037 .Cm upgrade
2038 .Fl v
2039 .Xc
2040 Displays legacy ZFS versions supported by the current software.
2041 See
2042 .Xr zpool-features 5
2043 for a description of feature flags features supported by the current software.
2044 .It Xo
2045 .Nm
2046 .Cm upgrade
2047 .Op Fl V Ar version
2048 .Fl a Ns | Ns Ar pool Ns ...
2049 .Xc
2050 Enables all supported features on the given pool.
2051 Once this is done, the pool will no longer be accessible on systems that do not
2052 support feature flags.
2053 See
2054 .Xr zfs-features 5
2055 for details on compatibility with systems that support feature flags, but do not
2056 support all features enabled on the pool.
2057 .Bl -tag -width Ds
2058 .It Fl a
2059 Enables all supported features on all pools.
2060 .It Fl V Ar version
2061 Upgrade to the specified legacy version.
2062 If the
2063 .Fl V
2064 flag is specified, no features will be enabled on the pool.
2065 This option can only be used to increase the version number up to the last
2066 supported legacy version number.
2067 .El
2068 .El
2069 .Sh EXIT STATUS
2070 The following exit values are returned:
2071 .Bl -tag -width Ds
2072 .It Sy 0
2073 Successful completion.
2074 .It Sy 1
2075 An error occurred.
2076 .It Sy 2
2077 Invalid command line options were specified.
2078 .El
2079 .Sh EXAMPLES
2080 .Bl -tag -width Ds
2081 .It Sy Example 1 No Creating a RAID-Z Storage Pool
2082 The following command creates a pool with a single raidz root vdev that
2083 consists of six disks.
2084 .Bd -literal
2085 # zpool create tank raidz sda sdb sdc sdd sde sdf
2086 .Ed
2087 .It Sy Example 2 No Creating a Mirrored Storage Pool
2088 The following command creates a pool with two mirrors, where each mirror
2089 contains two disks.
2090 .Bd -literal
2091 # zpool create tank mirror sda sdb mirror sdc sdd
2092 .Ed
2093 .It Sy Example 3 No Creating a ZFS Storage Pool by Using Partitions
2094 The following command creates an unmirrored pool using two disk partitions.
2095 .Bd -literal
2096 # zpool create tank sda1 sdb2
2097 .Ed
2098 .It Sy Example 4 No Creating a ZFS Storage Pool by Using Files
2099 The following command creates an unmirrored pool using files.
2100 While not recommended, a pool based on files can be useful for experimental
2101 purposes.
2102 .Bd -literal
2103 # zpool create tank /path/to/file/a /path/to/file/b
2104 .Ed
2105 .It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool
2106 The following command adds two mirrored disks to the pool
2107 .Em tank ,
2108 assuming the pool is already made up of two-way mirrors.
2109 The additional space is immediately available to any datasets within the pool.
2110 .Bd -literal
2111 # zpool add tank mirror sda sdb
2112 .Ed
2113 .It Sy Example 6 No Listing Available ZFS Storage Pools
2114 The following command lists all available pools on the system.
2115 In this case, the pool
2116 .Em zion
2117 is faulted due to a missing device.
2118 The results from this command are similar to the following:
2119 .Bd -literal
2120 # zpool list
2121 NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
2122 rpool 19.9G 8.43G 11.4G 33% - 42% 1.00x ONLINE -
2123 tank 61.5G 20.0G 41.5G 48% - 32% 1.00x ONLINE -
2124 zion - - - - - - - FAULTED -
2125 .Ed
2126 .It Sy Example 7 No Destroying a ZFS Storage Pool
2127 The following command destroys the pool
2128 .Em tank
2129 and any datasets contained within.
2130 .Bd -literal
2131 # zpool destroy -f tank
2132 .Ed
2133 .It Sy Example 8 No Exporting a ZFS Storage Pool
2134 The following command exports the devices in pool
2135 .Em tank
2136 so that they can be relocated or later imported.
2137 .Bd -literal
2138 # zpool export tank
2139 .Ed
2140 .It Sy Example 9 No Importing a ZFS Storage Pool
2141 The following command displays available pools, and then imports the pool
2142 .Em tank
2143 for use on the system.
2144 The results from this command are similar to the following:
2145 .Bd -literal
2146 # zpool import
2147 pool: tank
2148 id: 15451357997522795478
2149 state: ONLINE
2150 action: The pool can be imported using its name or numeric identifier.
2151 config:
2152
2153 tank ONLINE
2154 mirror ONLINE
2155 sda ONLINE
2156 sdb ONLINE
2157
2158 # zpool import tank
2159 .Ed
2160 .It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version
2161 The following command upgrades all ZFS Storage pools to the current version of
2162 the software.
2163 .Bd -literal
2164 # zpool upgrade -a
2165 This system is currently running ZFS version 2.
2166 .Ed
2167 .It Sy Example 11 No Managing Hot Spares
2168 The following command creates a new pool with an available hot spare:
2169 .Bd -literal
2170 # zpool create tank mirror sda sdb spare sdc
2171 .Ed
2172 .Pp
2173 If one of the disks were to fail, the pool would be reduced to the degraded
2174 state.
2175 The failed device can be replaced using the following command:
2176 .Bd -literal
2177 # zpool replace tank sda sdd
2178 .Ed
2179 .Pp
2180 Once the data has been resilvered, the spare is automatically removed and is
2181 made available for use should another device fail.
2182 The hot spare can be permanently removed from the pool using the following
2183 command:
2184 .Bd -literal
2185 # zpool remove tank sdc
2186 .Ed
2187 .It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs
2188 The following command creates a ZFS storage pool consisting of two, two-way
2189 mirrors and mirrored log devices:
2190 .Bd -literal
2191 # zpool create pool mirror sda sdb mirror sdc sdd log mirror \\
2192 sde sdf
2193 .Ed
2194 .It Sy Example 13 No Adding Cache Devices to a ZFS Pool
2195 The following command adds two disks for use as cache devices to a ZFS storage
2196 pool:
2197 .Bd -literal
2198 # zpool add pool cache sdc sdd
2199 .Ed
2200 .Pp
2201 Once added, the cache devices gradually fill with content from main memory.
2202 Depending on the size of your cache devices, it could take over an hour for
2203 them to fill.
2204 Capacity and reads can be monitored using the
2205 .Cm iostat
2206 option as follows:
2207 .Bd -literal
2208 # zpool iostat -v pool 5
2209 .Ed
2210 .It Sy Example 14 No Removing a Mirrored Log Device
2211 The following command removes the mirrored log device
2212 .Sy mirror-2 .
2213 Given this configuration:
2214 .Bd -literal
2215 pool: tank
2216 state: ONLINE
2217 scrub: none requested
2218 config:
2219
2220 NAME STATE READ WRITE CKSUM
2221 tank ONLINE 0 0 0
2222 mirror-0 ONLINE 0 0 0
2223 sda ONLINE 0 0 0
2224 sdb ONLINE 0 0 0
2225 mirror-1 ONLINE 0 0 0
2226 sdc ONLINE 0 0 0
2227 sdd ONLINE 0 0 0
2228 logs
2229 mirror-2 ONLINE 0 0 0
2230 sde ONLINE 0 0 0
2231 sdf ONLINE 0 0 0
2232 .Ed
2233 .Pp
2234 The command to remove the mirrored log
2235 .Sy mirror-2
2236 is:
2237 .Bd -literal
2238 # zpool remove tank mirror-2
2239 .Ed
2240 .It Sy Example 15 No Displaying expanded space on a device
2241 The following command displays the detailed information for the pool
2242 .Em data .
2243 This pool is comprised of a single raidz vdev where one of its devices
2244 increased its capacity by 10GB.
2245 In this example, the pool will not be able to utilize this extra capacity until
2246 all the devices under the raidz vdev have been expanded.
2247 .Bd -literal
2248 # zpool list -v data
2249 NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
2250 data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE -
2251 raidz1 23.9G 14.6G 9.30G 48% -
2252 sda - - - - -
2253 sdb - - - - 10G
2254 sdc - - - - -
2255 .Ed
2256 .It Sy Example 16 No Adding output columns
2257 Additional columns can be added to the
2258 .Nm zpool Cm status
2259 and
2260 .Nm zpool Cm iostat
2261 output with
2262 .Fl c
2263 option.
2264 .Bd -literal
2265 # zpool status -c vendor,model,size
2266 NAME STATE READ WRITE CKSUM vendor model size
2267 tank ONLINE 0 0 0
2268 mirror-0 ONLINE 0 0 0
2269 U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2270 U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2271 U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2272 U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2273 U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2274 U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
2275
2276 # zpool iostat -vc slaves
2277 capacity operations bandwidth
2278 pool alloc free read write read write slaves
2279 ---------- ----- ----- ----- ----- ----- ----- ---------
2280 tank 20.4G 7.23T 26 152 20.7M 21.6M
2281 mirror 20.4G 7.23T 26 152 20.7M 21.6M
2282 U1 - - 0 31 1.46K 20.6M sdb sdff
2283 U10 - - 0 1 3.77K 13.3K sdas sdgw
2284 U11 - - 0 1 288K 13.3K sdat sdgx
2285 U12 - - 0 1 78.4K 13.3K sdau sdgy
2286 U13 - - 0 1 128K 13.3K sdav sdgz
2287 U14 - - 0 1 63.2K 13.3K sdfk sdg
2288 .Ed
2289 .El
2290 .Sh ENVIRONMENT VARIABLES
2291 .Bl -tag -width "ZFS_ABORT"
2292 .It Ev ZFS_ABORT
2293 Cause
2294 .Nm zpool
2295 to dump core on exit for the purposes of running
2296 .Sy ::findleaks .
2297 .El
2298 .Bl -tag -width "ZPOOL_IMPORT_PATH"
2299 .It Ev ZPOOL_IMPORT_PATH
2300 The search path for devices or files to use with the pool. This is a colon-separated list of directories in which
2301 .Nm zpool
2302 looks for device nodes and files.
2303 Similar to the
2304 .Fl d
2305 option in
2306 .Nm zpool import .
2307 .El
2308 .Bl -tag -width "ZPOOL_VDEV_NAME_GUID"
2309 .It Ev ZPOOL_VDEV_NAME_GUID
2310 Cause
2311 .Nm zpool subcommands to output vdev guids by default. This behavior
2312 is identical to the
2313 .Nm zpool status -g
2314 command line option.
2315 .El
2316 .Bl -tag -width "ZPOOL_VDEV_NAME_FOLLOW_LINKS"
2317 .It Ev ZPOOL_VDEV_NAME_FOLLOW_LINKS
2318 Cause
2319 .Nm zpool
2320 subcommands to follow links for vdev names by default. This behavior is identical to the
2321 .Nm zpool status -L
2322 command line option.
2323 .El
2324 .Bl -tag -width "ZPOOL_VDEV_NAME_PATH"
2325 .It Ev ZPOOL_VDEV_NAME_PATH
2326 Cause
2327 .Nm zpool
2328 subcommands to output full vdev path names by default. This
2329 behavior is identical to the
2330 .Nm zpool status -p
2331 command line option.
2332 .El
2333 .Bl -tag -width "ZFS_VDEV_DEVID_OPT_OUT"
2334 .It Ev ZFS_VDEV_DEVID_OPT_OUT
2335 Older ZFS on Linux implementations had issues when attempting to display pool
2336 config VDEV names if a
2337 .Sy devid
2338 NVP value is present in the pool's config.
2339 .Pp
2340 For example, a pool that originated on illumos platform would have a devid
2341 value in the config and
2342 .Nm zpool status
2343 would fail when listing the config.
2344 This would also be true for future Linux based pools.
2345 .Pp
2346 A pool can be stripped of any
2347 .Sy devid
2348 values on import or prevented from adding
2349 them on
2350 .Nm zpool create
2351 or
2352 .Nm zpool add
2353 by setting
2354 .Sy ZFS_VDEV_DEVID_OPT_OUT .
2355 .El
2356 .Bl -tag -width "ZPOOL_SCRIPTS_AS_ROOT"
2357 .It Ev ZPOOL_SCRIPTS_AS_ROOT
2358 Allow a privileged user to run the
2359 .Nm zpool status/iostat
2360 with the
2361 .Fl c
2362 option. Normally, only unprivileged users are allowed to run
2363 .Fl c .
2364 .El
2365 .Bl -tag -width "ZPOOL_SCRIPTS_PATH"
2366 .It Ev ZPOOL_SCRIPTS_PATH
2367 The search path for scripts when running
2368 .Nm zpool status/iostat
2369 with the
2370 .Fl c
2371 option. This is a colon-separated list of directories and overrides the default
2372 .Pa ~/.zpool.d
2373 and
2374 .Pa /etc/zfs/zpool.d
2375 search paths.
2376 .El
2377 .Bl -tag -width "ZPOOL_SCRIPTS_ENABLED"
2378 .It Ev ZPOOL_SCRIPTS_ENABLED
2379 Allow a user to run
2380 .Nm zpool status/iostat
2381 with the
2382 .Fl c
2383 option. If
2384 .Sy ZPOOL_SCRIPTS_ENABLED
2385 is not set, it is assumed that the user is allowed to run
2386 .Nm zpool status/iostat -c .
2387 .El
2388 .Sh INTERFACE STABILITY
2389 .Sy Evolving
2390 .Sh SEE ALSO
2391 .Xr zfs-events 5 ,
2392 .Xr zfs-module-parameters 5 ,
2393 .Xr zpool-features 5 ,
2394 .Xr zed 8 ,
2395 .Xr zfs 8