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) 2012, 2017 by Delphix. All rights reserved.
  24 .\" Copyright 2017 Nexenta Systems, Inc.
  25 .\" Copyright (c) 2017 Datto Inc.
  26 .\" Copyright (c) 2017 George Melikov. All Rights Reserved.
  27 .\"
  28 .Dd December 6, 2017
  29 .Dt ZPOOL 1M
  30 .Os
  31 .Sh NAME
  32 .Nm zpool
  33 .Nd configure ZFS storage pools
  34 .Sh SYNOPSIS
  35 .Nm
  36 .Fl \?
  37 .Nm
  38 .Cm add
  39 .Op Fl fn
  40 .Ar pool vdev Ns ...
  41 .Nm
  42 .Cm attach
  43 .Op Fl f
  44 .Ar pool device new_device
  45 .Nm
  46 .Cm clear
  47 .Ar pool
  48 .Op Ar device
  49 .Nm
  50 .Cm create
  51 .Op Fl dfn
  52 .Op Fl B
  53 .Op Fl m Ar mountpoint
  54 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
  55 .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
  56 .Op Fl R Ar root
  57 .Ar pool vdev Ns ...
  58 .Nm
  59 .Cm destroy
  60 .Op Fl f
  61 .Ar pool
  62 .Nm
  63 .Cm detach
  64 .Ar pool device
  65 .Nm
  66 .Cm export
  67 .Op Fl f
  68 .Ar pool Ns ...
  69 .Nm
  70 .Cm get
  71 .Op Fl Hp
  72 .Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
  73 .Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
  74 .Ar pool Ns ...
  75 .Nm
  76 .Cm history
  77 .Op Fl il
  78 .Oo Ar pool Oc Ns ...
  79 .Nm
  80 .Cm import
  81 .Op Fl D
  82 .Op Fl d Ar dir
  83 .Nm
  84 .Cm import
  85 .Fl a
  86 .Op Fl DfmN
  87 .Op Fl F Op Fl n
  88 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
  89 .Op Fl o Ar mntopts
  90 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
  91 .Op Fl R Ar root
  92 .Nm
  93 .Cm import
  94 .Op Fl Dfm
  95 .Op Fl F Op Fl n
  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 .Ar pool Ns | Ns Ar id
 101 .Op Ar newpool
 102 .Nm
 103 .Cm iostat
 104 .Op Fl v
 105 .Op Fl T Sy u Ns | Ns Sy d
 106 .Oo Ar pool Oc Ns ...
 107 .Op Ar interval Op Ar count
 108 .Nm
 109 .Cm labelclear
 110 .Op Fl f
 111 .Ar device
 112 .Nm
 113 .Cm list
 114 .Op Fl Hpv
 115 .Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
 116 .Op Fl T Sy u Ns | Ns Sy d
 117 .Oo Ar pool Oc Ns ...
 118 .Op Ar interval Op Ar count
 119 .Nm
 120 .Cm offline
 121 .Op Fl t
 122 .Ar pool Ar device Ns ...
 123 .Nm
 124 .Cm online
 125 .Op Fl e
 126 .Ar pool Ar device Ns ...
 127 .Nm
 128 .Cm reguid
 129 .Ar pool
 130 .Nm
 131 .Cm reopen
 132 .Ar pool
 133 .Nm
 134 .Cm remove
 135 .Op Fl np
 136 .Ar pool Ar device Ns ...
 137 .Nm
 138 .Cm remove
 139 .Fl s
 140 .Ar pool
 141 .Nm
 142 .Cm replace
 143 .Op Fl f
 144 .Ar pool Ar device Op Ar new_device
 145 .Nm
 146 .Cm scrub
 147 .Op Fl s | Fl p
 148 .Ar pool Ns ...
 149 .Nm
 150 .Cm set
 151 .Ar property Ns = Ns Ar value
 152 .Ar pool
 153 .Nm
 154 .Cm split
 155 .Op Fl n
 156 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
 157 .Op Fl R Ar root
 158 .Ar pool newpool
 159 .Nm
 160 .Cm status
 161 .Op Fl Dvx
 162 .Op Fl T Sy u Ns | Ns Sy d
 163 .Oo Ar pool Oc Ns ...
 164 .Op Ar interval Op Ar count
 165 .Nm
 166 .Cm upgrade
 167 .Nm
 168 .Cm upgrade
 169 .Fl v
 170 .Nm
 171 .Cm upgrade
 172 .Op Fl V Ar version
 173 .Fl a Ns | Ns Ar pool Ns ...
 174 .Sh DESCRIPTION
 175 The
 176 .Nm
 177 command configures ZFS storage pools.
 178 A storage pool is a collection of devices that provides physical storage and
 179 data replication for ZFS datasets.
 180 All datasets within a storage pool share the same space.
 181 See
 182 .Xr zfs 1M
 183 for information on managing datasets.
 184 .Ss Virtual Devices (vdevs)
 185 A "virtual device" describes a single device or a collection of devices
 186 organized according to certain performance and fault characteristics.
 187 The following virtual devices are supported:
 188 .Bl -tag -width Ds
 189 .It Sy disk
 190 A block device, typically located under
 191 .Pa /dev/dsk .
 192 ZFS can use individual slices or partitions, though the recommended mode of
 193 operation is to use whole disks.
 194 A disk can be specified by a full path, or it can be a shorthand name
 195 .Po the relative portion of the path under
 196 .Pa /dev/dsk
 197 .Pc .
 198 A whole disk can be specified by omitting the slice or partition designation.
 199 For example,
 200 .Pa c0t0d0
 201 is equivalent to
 202 .Pa /dev/dsk/c0t0d0s2 .
 203 When given a whole disk, ZFS automatically labels the disk, if necessary.
 204 .It Sy file
 205 A regular file.
 206 The use of files as a backing store is strongly discouraged.
 207 It is designed primarily for experimental purposes, as the fault tolerance of a
 208 file is only as good as the file system of which it is a part.
 209 A file must be specified by a full path.
 210 .It Sy mirror
 211 A mirror of two or more devices.
 212 Data is replicated in an identical fashion across all components of a mirror.
 213 A mirror with N disks of size X can hold X bytes and can withstand (N-1) devices
 214 failing before data integrity is compromised.
 215 .It Sy raidz , raidz1 , raidz2 , raidz3
 216 A variation on RAID-5 that allows for better distribution of parity and
 217 eliminates the RAID-5
 218 .Qq write hole
 219 .Pq in which data and parity become inconsistent after a power loss .
 220 Data and parity is striped across all disks within a raidz group.
 221 .Pp
 222 A raidz group can have single-, double-, or triple-parity, meaning that the
 223 raidz group can sustain one, two, or three failures, respectively, without
 224 losing any data.
 225 The
 226 .Sy raidz1
 227 vdev type specifies a single-parity raidz group; the
 228 .Sy raidz2
 229 vdev type specifies a double-parity raidz group; and the
 230 .Sy raidz3
 231 vdev type specifies a triple-parity raidz group.
 232 The
 233 .Sy raidz
 234 vdev type is an alias for
 235 .Sy raidz1 .
 236 .Pp
 237 A raidz group with N disks of size X with P parity disks can hold approximately
 238 (N-P)*X bytes and can withstand P device(s) failing before data integrity is
 239 compromised.
 240 The minimum number of devices in a raidz group is one more than the number of
 241 parity disks.
 242 The recommended number is between 3 and 9 to help increase performance.
 243 .It Sy spare
 244 A special pseudo-vdev which keeps track of available hot spares for a pool.
 245 For more information, see the
 246 .Sx Hot Spares
 247 section.
 248 .It Sy log
 249 A separate intent log device.
 250 If more than one log device is specified, then writes are load-balanced between
 251 devices.
 252 Log devices can be mirrored.
 253 However, raidz vdev types are not supported for the intent log.
 254 For more information, see the
 255 .Sx Intent Log
 256 section.
 257 .It Sy cache
 258 A device used to cache storage pool data.
 259 A cache device cannot be configured as a mirror or raidz group.
 260 For more information, see the
 261 .Sx Cache Devices
 262 section.
 263 .El
 264 .Pp
 265 Virtual devices cannot be nested, so a mirror or raidz virtual device can only
 266 contain files or disks.
 267 Mirrors of mirrors
 268 .Pq or other combinations
 269 are not allowed.
 270 .Pp
 271 A pool can have any number of virtual devices at the top of the configuration
 272 .Po known as
 273 .Qq root vdevs
 274 .Pc .
 275 Data is dynamically distributed across all top-level devices to balance data
 276 among devices.
 277 As new virtual devices are added, ZFS automatically places data on the newly
 278 available devices.
 279 .Pp
 280 Virtual devices are specified one at a time on the command line, separated by
 281 whitespace.
 282 The keywords
 283 .Sy mirror
 284 and
 285 .Sy raidz
 286 are used to distinguish where a group ends and another begins.
 287 For example, the following creates two root vdevs, each a mirror of two disks:
 288 .Bd -literal
 289 # zpool create mypool mirror c0t0d0 c0t1d0 mirror c1t0d0 c1t1d0
 290 .Ed
 291 .Ss Device Failure and Recovery
 292 ZFS supports a rich set of mechanisms for handling device failure and data
 293 corruption.
 294 All metadata and data is checksummed, and ZFS automatically repairs bad data
 295 from a good copy when corruption is detected.
 296 .Pp
 297 In order to take advantage of these features, a pool must make use of some form
 298 of redundancy, using either mirrored or raidz groups.
 299 While ZFS supports running in a non-redundant configuration, where each root
 300 vdev is simply a disk or file, this is strongly discouraged.
 301 A single case of bit corruption can render some or all of your data unavailable.
 302 .Pp
 303 A pool's health status is described by one of three states: online, degraded,
 304 or faulted.
 305 An online pool has all devices operating normally.
 306 A degraded pool is one in which one or more devices have failed, but the data is
 307 still available due to a redundant configuration.
 308 A faulted pool has corrupted metadata, or one or more faulted devices, and
 309 insufficient replicas to continue functioning.
 310 .Pp
 311 The health of the top-level vdev, such as mirror or raidz device, is
 312 potentially impacted by the state of its associated vdevs, or component
 313 devices.
 314 A top-level vdev or component device is in one of the following states:
 315 .Bl -tag -width "DEGRADED"
 316 .It Sy DEGRADED
 317 One or more top-level vdevs is in the degraded state because one or more
 318 component devices are offline.
 319 Sufficient replicas exist to continue functioning.
 320 .Pp
 321 One or more component devices is in the degraded or faulted state, but
 322 sufficient replicas exist to continue functioning.
 323 The underlying conditions are as follows:
 324 .Bl -bullet
 325 .It
 326 The number of checksum errors exceeds acceptable levels and the device is
 327 degraded as an indication that something may be wrong.
 328 ZFS continues to use the device as necessary.
 329 .It
 330 The number of I/O errors exceeds acceptable levels.
 331 The device could not be marked as faulted because there are insufficient
 332 replicas to continue functioning.
 333 .El
 334 .It Sy FAULTED
 335 One or more top-level vdevs is in the faulted state because one or more
 336 component devices are offline.
 337 Insufficient replicas exist to continue functioning.
 338 .Pp
 339 One or more component devices is in the faulted state, and insufficient
 340 replicas exist to continue functioning.
 341 The underlying conditions are as follows:
 342 .Bl -bullet
 343 .It
 344 The device could be opened, but the contents did not match expected values.
 345 .It
 346 The number of I/O errors exceeds acceptable levels and the device is faulted to
 347 prevent further use of the device.
 348 .El
 349 .It Sy OFFLINE
 350 The device was explicitly taken offline by the
 351 .Nm zpool Cm offline
 352 command.
 353 .It Sy ONLINE
 354 The device is online and functioning.
 355 .It Sy REMOVED
 356 The device was physically removed while the system was running.
 357 Device removal detection is hardware-dependent and may not be supported on all
 358 platforms.
 359 .It Sy UNAVAIL
 360 The device could not be opened.
 361 If a pool is imported when a device was unavailable, then the device will be
 362 identified by a unique identifier instead of its path since the path was never
 363 correct in the first place.
 364 .El
 365 .Pp
 366 If a device is removed and later re-attached to the system, ZFS attempts
 367 to put the device online automatically.
 368 Device attach detection is hardware-dependent and might not be supported on all
 369 platforms.
 370 .Ss Hot Spares
 371 ZFS allows devices to be associated with pools as
 372 .Qq hot spares .
 373 These devices are not actively used in the pool, but when an active device
 374 fails, it is automatically replaced by a hot spare.
 375 To create a pool with hot spares, specify a
 376 .Sy spare
 377 vdev with any number of devices.
 378 For example,
 379 .Bd -literal
 380 # zpool create pool mirror c0d0 c1d0 spare c2d0 c3d0
 381 .Ed
 382 .Pp
 383 Spares can be shared across multiple pools, and can be added with the
 384 .Nm zpool Cm add
 385 command and removed with the
 386 .Nm zpool Cm remove
 387 command.
 388 Once a spare replacement is initiated, a new
 389 .Sy spare
 390 vdev is created within the configuration that will remain there until the
 391 original device is replaced.
 392 At this point, the hot spare becomes available again if another device fails.
 393 .Pp
 394 If a pool has a shared spare that is currently being used, the pool can not be
 395 exported since other pools may use this shared spare, which may lead to
 396 potential data corruption.
 397 .Pp
 398 An in-progress spare replacement can be cancelled by detaching the hot spare.
 399 If the original faulted device is detached, then the hot spare assumes its
 400 place in the configuration, and is removed from the spare list of all active
 401 pools.
 402 .Pp
 403 Spares cannot replace log devices.
 404 .Ss Intent Log
 405 The ZFS Intent Log (ZIL) satisfies POSIX requirements for synchronous
 406 transactions.
 407 For instance, databases often require their transactions to be on stable storage
 408 devices when returning from a system call.
 409 NFS and other applications can also use
 410 .Xr fsync 3C
 411 to ensure data stability.
 412 By default, the intent log is allocated from blocks within the main pool.
 413 However, it might be possible to get better performance using separate intent
 414 log devices such as NVRAM or a dedicated disk.
 415 For example:
 416 .Bd -literal
 417 # zpool create pool c0d0 c1d0 log c2d0
 418 .Ed
 419 .Pp
 420 Multiple log devices can also be specified, and they can be mirrored.
 421 See the
 422 .Sx EXAMPLES
 423 section for an example of mirroring multiple log devices.
 424 .Pp
 425 Log devices can be added, replaced, attached, detached, and imported and
 426 exported as part of the larger pool.
 427 Mirrored devices can be removed by specifying the top-level mirror vdev.
 428 .Ss Cache Devices
 429 Devices can be added to a storage pool as
 430 .Qq cache devices .
 431 These devices provide an additional layer of caching between main memory and
 432 disk.
 433 For read-heavy workloads, where the working set size is much larger than what
 434 can be cached in main memory, using cache devices allow much more of this
 435 working set to be served from low latency media.
 436 Using cache devices provides the greatest performance improvement for random
 437 read-workloads of mostly static content.
 438 .Pp
 439 To create a pool with cache devices, specify a
 440 .Sy cache
 441 vdev with any number of devices.
 442 For example:
 443 .Bd -literal
 444 # zpool create pool c0d0 c1d0 cache c2d0 c3d0
 445 .Ed
 446 .Pp
 447 Cache devices cannot be mirrored or part of a raidz configuration.
 448 If a read error is encountered on a cache device, that read I/O is reissued to
 449 the original storage pool device, which might be part of a mirrored or raidz
 450 configuration.
 451 .Pp
 452 The content of the cache devices is considered volatile, as is the case with
 453 other system caches.
 454 .Ss Properties
 455 Each pool has several properties associated with it.
 456 Some properties are read-only statistics while others are configurable and
 457 change the behavior of the pool.
 458 .Pp
 459 The following are read-only properties:
 460 .Bl -tag -width Ds
 461 .It Cm allocated
 462 Amount of storage space used within the pool.
 463 .It Sy bootsize
 464 The size of the system boot partition.
 465 This property can only be set at pool creation time and is read-only once pool
 466 is created.
 467 Setting this property implies using the
 468 .Fl B
 469 option.
 470 .It Sy capacity
 471 Percentage of pool space used.
 472 This property can also be referred to by its shortened column name,
 473 .Sy cap .
 474 .It Sy expandsize
 475 Amount of uninitialized space within the pool or device that can be used to
 476 increase the total capacity of the pool.
 477 Uninitialized space consists of any space on an EFI labeled vdev which has not
 478 been brought online
 479 .Po e.g, using
 480 .Nm zpool Cm online Fl e
 481 .Pc .
 482 This space occurs when a LUN is dynamically expanded.
 483 .It Sy fragmentation
 484 The amount of fragmentation in the pool.
 485 .It Sy free
 486 The amount of free space available in the pool.
 487 .It Sy freeing
 488 After a file system or snapshot is destroyed, the space it was using is
 489 returned to the pool asynchronously.
 490 .Sy freeing
 491 is the amount of space remaining to be reclaimed.
 492 Over time
 493 .Sy freeing
 494 will decrease while
 495 .Sy free
 496 increases.
 497 .It Sy health
 498 The current health of the pool.
 499 Health can be one of
 500 .Sy ONLINE , DEGRADED , FAULTED , OFFLINE, REMOVED , UNAVAIL .
 501 .It Sy guid
 502 A unique identifier for the pool.
 503 .It Sy size
 504 Total size of the storage pool.
 505 .It Sy unsupported@ Ns Em feature_guid
 506 Information about unsupported features that are enabled on the pool.
 507 See
 508 .Xr zpool-features 5
 509 for details.
 510 .El
 511 .Pp
 512 The space usage properties report actual physical space available to the
 513 storage pool.
 514 The physical space can be different from the total amount of space that any
 515 contained datasets can actually use.
 516 The amount of space used in a raidz configuration depends on the characteristics
 517 of the data being written.
 518 In addition, ZFS reserves some space for internal accounting that the
 519 .Xr zfs 1M
 520 command takes into account, but the
 521 .Nm
 522 command does not.
 523 For non-full pools of a reasonable size, these effects should be invisible.
 524 For small pools, or pools that are close to being completely full, these
 525 discrepancies may become more noticeable.
 526 .Pp
 527 The following property can be set at creation time and import time:
 528 .Bl -tag -width Ds
 529 .It Sy altroot
 530 Alternate root directory.
 531 If set, this directory is prepended to any mount points within the pool.
 532 This can be used when examining an unknown pool where the mount points cannot be
 533 trusted, or in an alternate boot environment, where the typical paths are not
 534 valid.
 535 .Sy altroot
 536 is not a persistent property.
 537 It is valid only while the system is up.
 538 Setting
 539 .Sy altroot
 540 defaults to using
 541 .Sy cachefile Ns = Ns Sy none ,
 542 though this may be overridden using an explicit setting.
 543 .El
 544 .Pp
 545 The following property can be set only at import time:
 546 .Bl -tag -width Ds
 547 .It Sy readonly Ns = Ns Sy on Ns | Ns Sy off
 548 If set to
 549 .Sy on ,
 550 the pool will be imported in read-only mode.
 551 This property can also be referred to by its shortened column name,
 552 .Sy rdonly .
 553 .El
 554 .Pp
 555 The following properties can be set at creation time and import time, and later
 556 changed with the
 557 .Nm zpool Cm set
 558 command:
 559 .Bl -tag -width Ds
 560 .It Sy autoexpand Ns = Ns Sy on Ns | Ns Sy off
 561 Controls automatic pool expansion when the underlying LUN is grown.
 562 If set to
 563 .Sy on ,
 564 the pool will be resized according to the size of the expanded device.
 565 If the device is part of a mirror or raidz then all devices within that
 566 mirror/raidz group must be expanded before the new space is made available to
 567 the pool.
 568 The default behavior is
 569 .Sy off .
 570 This property can also be referred to by its shortened column name,
 571 .Sy expand .
 572 .It Sy autoreplace Ns = Ns Sy on Ns | Ns Sy off
 573 Controls automatic device replacement.
 574 If set to
 575 .Sy off ,
 576 device replacement must be initiated by the administrator by using the
 577 .Nm zpool Cm replace
 578 command.
 579 If set to
 580 .Sy on ,
 581 any new device, found in the same physical location as a device that previously
 582 belonged to the pool, is automatically formatted and replaced.
 583 The default behavior is
 584 .Sy off .
 585 This property can also be referred to by its shortened column name,
 586 .Sy replace .
 587 .It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset
 588 Identifies the default bootable dataset for the root pool.
 589 This property is expected to be set mainly by the installation and upgrade
 590 programs.
 591 .It Sy cachefile Ns = Ns Ar path Ns | Ns Sy none
 592 Controls the location of where the pool configuration is cached.
 593 Discovering all pools on system startup requires a cached copy of the
 594 configuration data that is stored on the root file system.
 595 All pools in this cache are automatically imported when the system boots.
 596 Some environments, such as install and clustering, need to cache this
 597 information in a different location so that pools are not automatically
 598 imported.
 599 Setting this property caches the pool configuration in a different location that
 600 can later be imported with
 601 .Nm zpool Cm import Fl c .
 602 Setting it to the special value
 603 .Sy none
 604 creates a temporary pool that is never cached, and the special value
 605 .Qq
 606 .Pq empty string
 607 uses the default location.
 608 .Pp
 609 Multiple pools can share the same cache file.
 610 Because the kernel destroys and recreates this file when pools are added and
 611 removed, care should be taken when attempting to access this file.
 612 When the last pool using a
 613 .Sy cachefile
 614 is exported or destroyed, the file is removed.
 615 .It Sy comment Ns = Ns Ar text
 616 A text string consisting of printable ASCII characters that will be stored
 617 such that it is available even if the pool becomes faulted.
 618 An administrator can provide additional information about a pool using this
 619 property.
 620 .It Sy dedupditto Ns = Ns Ar number
 621 Threshold for the number of block ditto copies.
 622 If the reference count for a deduplicated block increases above this number, a
 623 new ditto copy of this block is automatically stored.
 624 The default setting is
 625 .Sy 0
 626 which causes no ditto copies to be created for deduplicated blocks.
 627 The minimum legal nonzero setting is
 628 .Sy 100 .
 629 .It Sy delegation Ns = Ns Sy on Ns | Ns Sy off
 630 Controls whether a non-privileged user is granted access based on the dataset
 631 permissions defined on the dataset.
 632 See
 633 .Xr zfs 1M
 634 for more information on ZFS delegated administration.
 635 .It Sy failmode Ns = Ns Sy wait Ns | Ns Sy continue Ns | Ns Sy panic
 636 Controls the system behavior in the event of catastrophic pool failure.
 637 This condition is typically a result of a loss of connectivity to the underlying
 638 storage device(s) or a failure of all devices within the pool.
 639 The behavior of such an event is determined as follows:
 640 .Bl -tag -width "continue"
 641 .It Sy wait
 642 Blocks all I/O access until the device connectivity is recovered and the errors
 643 are cleared.
 644 This is the default behavior.
 645 .It Sy continue
 646 Returns
 647 .Er EIO
 648 to any new write I/O requests but allows reads to any of the remaining healthy
 649 devices.
 650 Any write requests that have yet to be committed to disk would be blocked.
 651 .It Sy panic
 652 Prints out a message to the console and generates a system crash dump.
 653 .El
 654 .It Sy feature@ Ns Ar feature_name Ns = Ns Sy enabled
 655 The value of this property is the current state of
 656 .Ar feature_name .
 657 The only valid value when setting this property is
 658 .Sy enabled
 659 which moves
 660 .Ar feature_name
 661 to the enabled state.
 662 See
 663 .Xr zpool-features 5
 664 for details on feature states.
 665 .It Sy listsnapshots Ns = Ns Sy on Ns | Ns Sy off
 666 Controls whether information about snapshots associated with this pool is
 667 output when
 668 .Nm zfs Cm list
 669 is run without the
 670 .Fl t
 671 option.
 672 The default value is
 673 .Sy off .
 674 This property can also be referred to by its shortened name,
 675 .Sy listsnaps .
 676 .It Sy version Ns = Ns Ar version
 677 The current on-disk version of the pool.
 678 This can be increased, but never decreased.
 679 The preferred method of updating pools is with the
 680 .Nm zpool Cm upgrade
 681 command, though this property can be used when a specific version is needed for
 682 backwards compatibility.
 683 Once feature flags are enabled on a pool this property will no longer have a
 684 value.
 685 .El
 686 .Ss Subcommands
 687 All subcommands that modify state are logged persistently to the pool in their
 688 original form.
 689 .Pp
 690 The
 691 .Nm
 692 command provides subcommands to create and destroy storage pools, add capacity
 693 to storage pools, and provide information about the storage pools.
 694 The following subcommands are supported:
 695 .Bl -tag -width Ds
 696 .It Xo
 697 .Nm
 698 .Fl \?
 699 .Xc
 700 Displays a help message.
 701 .It Xo
 702 .Nm
 703 .Cm add
 704 .Op Fl fn
 705 .Ar pool vdev Ns ...
 706 .Xc
 707 Adds the specified virtual devices to the given pool.
 708 The
 709 .Ar vdev
 710 specification is described in the
 711 .Sx Virtual Devices
 712 section.
 713 The behavior of the
 714 .Fl f
 715 option, and the device checks performed are described in the
 716 .Nm zpool Cm create
 717 subcommand.
 718 .Bl -tag -width Ds
 719 .It Fl f
 720 Forces use of
 721 .Ar vdev Ns s ,
 722 even if they appear in use or specify a conflicting replication level.
 723 Not all devices can be overridden in this manner.
 724 .It Fl n
 725 Displays the configuration that would be used without actually adding the
 726 .Ar vdev Ns s .
 727 The actual pool creation can still fail due to insufficient privileges or
 728 device sharing.
 729 .El
 730 .It Xo
 731 .Nm
 732 .Cm attach
 733 .Op Fl f
 734 .Ar pool device new_device
 735 .Xc
 736 Attaches
 737 .Ar new_device
 738 to the existing
 739 .Ar device .
 740 The existing device cannot be part of a raidz configuration.
 741 If
 742 .Ar device
 743 is not currently part of a mirrored configuration,
 744 .Ar device
 745 automatically transforms into a two-way mirror of
 746 .Ar device
 747 and
 748 .Ar new_device .
 749 If
 750 .Ar device
 751 is part of a two-way mirror, attaching
 752 .Ar new_device
 753 creates a three-way mirror, and so on.
 754 In either case,
 755 .Ar new_device
 756 begins to resilver immediately.
 757 .Bl -tag -width Ds
 758 .It Fl f
 759 Forces use of
 760 .Ar new_device ,
 761 even if its appears to be in use.
 762 Not all devices can be overridden in this manner.
 763 .El
 764 .It Xo
 765 .Nm
 766 .Cm clear
 767 .Ar pool
 768 .Op Ar device
 769 .Xc
 770 Clears device errors in a pool.
 771 If no arguments are specified, all device errors within the pool are cleared.
 772 If one or more devices is specified, only those errors associated with the
 773 specified device or devices are cleared.
 774 .It Xo
 775 .Nm
 776 .Cm create
 777 .Op Fl dfn
 778 .Op Fl B
 779 .Op Fl m Ar mountpoint
 780 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
 781 .Oo Fl O Ar file-system-property Ns = Ns Ar value Oc Ns ...
 782 .Op Fl R Ar root
 783 .Ar pool vdev Ns ...
 784 .Xc
 785 Creates a new storage pool containing the virtual devices specified on the
 786 command line.
 787 The pool name must begin with a letter, and can only contain
 788 alphanumeric characters as well as underscore
 789 .Pq Qq Sy _ ,
 790 dash
 791 .Pq Qq Sy - ,
 792 and period
 793 .Pq Qq Sy \&. .
 794 The pool names
 795 .Sy mirror ,
 796 .Sy raidz ,
 797 .Sy spare
 798 and
 799 .Sy log
 800 are reserved, as are names beginning with the pattern
 801 .Sy c[0-9] .
 802 The
 803 .Ar vdev
 804 specification is described in the
 805 .Sx Virtual Devices
 806 section.
 807 .Pp
 808 The command verifies that each device specified is accessible and not currently
 809 in use by another subsystem.
 810 There are some uses, such as being currently mounted, or specified as the
 811 dedicated dump device, that prevents a device from ever being used by ZFS.
 812 Other uses, such as having a preexisting UFS file system, can be overridden with
 813 the
 814 .Fl f
 815 option.
 816 .Pp
 817 The command also checks that the replication strategy for the pool is
 818 consistent.
 819 An attempt to combine redundant and non-redundant storage in a single pool, or
 820 to mix disks and files, results in an error unless
 821 .Fl f
 822 is specified.
 823 The use of differently sized devices within a single raidz or mirror group is
 824 also flagged as an error unless
 825 .Fl f
 826 is specified.
 827 .Pp
 828 Unless the
 829 .Fl R
 830 option is specified, the default mount point is
 831 .Pa / Ns Ar pool .
 832 The mount point must not exist or must be empty, or else the root dataset
 833 cannot be mounted.
 834 This can be overridden with the
 835 .Fl m
 836 option.
 837 .Pp
 838 By default all supported features are enabled on the new pool unless the
 839 .Fl d
 840 option is specified.
 841 .Bl -tag -width Ds
 842 .It Fl B
 843 Create whole disk pool with EFI System partition to support booting system
 844 with UEFI firmware.
 845 Default size is 256MB.
 846 To create boot partition with custom size, set the
 847 .Sy bootsize
 848 property with the
 849 .Fl o
 850 option.
 851 See the
 852 .Sx Properties
 853 section for details.
 854 .It Fl d
 855 Do not enable any features on the new pool.
 856 Individual features can be enabled by setting their corresponding properties to
 857 .Sy enabled
 858 with the
 859 .Fl o
 860 option.
 861 See
 862 .Xr zpool-features 5
 863 for details about feature properties.
 864 .It Fl f
 865 Forces use of
 866 .Ar vdev Ns s ,
 867 even if they appear in use or specify a conflicting replication level.
 868 Not all devices can be overridden in this manner.
 869 .It Fl m Ar mountpoint
 870 Sets the mount point for the root dataset.
 871 The default mount point is
 872 .Pa /pool
 873 or
 874 .Pa altroot/pool
 875 if
 876 .Ar altroot
 877 is specified.
 878 The mount point must be an absolute path,
 879 .Sy legacy ,
 880 or
 881 .Sy none .
 882 For more information on dataset mount points, see
 883 .Xr zfs 1M .
 884 .It Fl n
 885 Displays the configuration that would be used without actually creating the
 886 pool.
 887 The actual pool creation can still fail due to insufficient privileges or
 888 device sharing.
 889 .It Fl o Ar property Ns = Ns Ar value
 890 Sets the given pool properties.
 891 See the
 892 .Sx Properties
 893 section for a list of valid properties that can be set.
 894 .It Fl O Ar file-system-property Ns = Ns Ar value
 895 Sets the given file system properties in the root file system of the pool.
 896 See the
 897 .Sx Properties
 898 section of
 899 .Xr zfs 1M
 900 for a list of valid properties that can be set.
 901 .It Fl R Ar root
 902 Equivalent to
 903 .Fl o Sy cachefile Ns = Ns Sy none Fl o Sy altroot Ns = Ns Ar root
 904 .El
 905 .It Xo
 906 .Nm
 907 .Cm destroy
 908 .Op Fl f
 909 .Ar pool
 910 .Xc
 911 Destroys the given pool, freeing up any devices for other use.
 912 This command tries to unmount any active datasets before destroying the pool.
 913 .Bl -tag -width Ds
 914 .It Fl f
 915 Forces any active datasets contained within the pool to be unmounted.
 916 .El
 917 .It Xo
 918 .Nm
 919 .Cm detach
 920 .Ar pool device
 921 .Xc
 922 Detaches
 923 .Ar device
 924 from a mirror.
 925 The operation is refused if there are no other valid replicas of the data.
 926 .It Xo
 927 .Nm
 928 .Cm export
 929 .Op Fl f
 930 .Ar pool Ns ...
 931 .Xc
 932 Exports the given pools from the system.
 933 All devices are marked as exported, but are still considered in use by other
 934 subsystems.
 935 The devices can be moved between systems
 936 .Pq even those of different endianness
 937 and imported as long as a sufficient number of devices are present.
 938 .Pp
 939 Before exporting the pool, all datasets within the pool are unmounted.
 940 A pool can not be exported if it has a shared spare that is currently being
 941 used.
 942 .Pp
 943 For pools to be portable, you must give the
 944 .Nm
 945 command whole disks, not just slices, so that ZFS can label the disks with
 946 portable EFI labels.
 947 Otherwise, disk drivers on platforms of different endianness will not recognize
 948 the disks.
 949 .Bl -tag -width Ds
 950 .It Fl f
 951 Forcefully unmount all datasets, using the
 952 .Nm unmount Fl f
 953 command.
 954 .Pp
 955 This command will forcefully export the pool even if it has a shared spare that
 956 is currently being used.
 957 This may lead to potential data corruption.
 958 .El
 959 .It Xo
 960 .Nm
 961 .Cm get
 962 .Op Fl Hp
 963 .Op Fl o Ar field Ns Oo , Ns Ar field Oc Ns ...
 964 .Sy all Ns | Ns Ar property Ns Oo , Ns Ar property Oc Ns ...
 965 .Ar pool Ns ...
 966 .Xc
 967 Retrieves the given list of properties
 968 .Po
 969 or all properties if
 970 .Sy all
 971 is used
 972 .Pc
 973 for the specified storage pool(s).
 974 These properties are displayed with the following fields:
 975 .Bd -literal
 976         name          Name of storage pool
 977         property      Property name
 978         value         Property value
 979         source        Property source, either 'default' or 'local'.
 980 .Ed
 981 .Pp
 982 See the
 983 .Sx Properties
 984 section for more information on the available pool properties.
 985 .Bl -tag -width Ds
 986 .It Fl H
 987 Scripted mode.
 988 Do not display headers, and separate fields by a single tab instead of arbitrary
 989 space.
 990 .It Fl o Ar field
 991 A comma-separated list of columns to display.
 992 .Sy name Ns \&, Ns Sy property Ns \&, Ns Sy value Ns \&, Ns Sy source
 993 is the default value.
 994 .It Fl p
 995 Display numbers in parsable (exact) values.
 996 .El
 997 .It Xo
 998 .Nm
 999 .Cm history
1000 .Op Fl il
1001 .Oo Ar pool Oc Ns ...
1002 .Xc
1003 Displays the command history of the specified pool(s) or all pools if no pool is
1004 specified.
1005 .Bl -tag -width Ds
1006 .It Fl i
1007 Displays internally logged ZFS events in addition to user initiated events.
1008 .It Fl l
1009 Displays log records in long format, which in addition to standard format
1010 includes, the user name, the hostname, and the zone in which the operation was
1011 performed.
1012 .El
1013 .It Xo
1014 .Nm
1015 .Cm import
1016 .Op Fl D
1017 .Op Fl d Ar dir
1018 .Xc
1019 Lists pools available to import.
1020 If the
1021 .Fl d
1022 option is not specified, this command searches for devices in
1023 .Pa /dev/dsk .
1024 The
1025 .Fl d
1026 option can be specified multiple times, and all directories are searched.
1027 If the device appears to be part of an exported pool, this command displays a
1028 summary of the pool with the name of the pool, a numeric identifier, as well as
1029 the vdev layout and current health of the device for each device or file.
1030 Destroyed pools, pools that were previously destroyed with the
1031 .Nm zpool Cm destroy
1032 command, are not listed unless the
1033 .Fl D
1034 option is specified.
1035 .Pp
1036 The numeric identifier is unique, and can be used instead of the pool name when
1037 multiple exported pools of the same name are available.
1038 .Bl -tag -width Ds
1039 .It Fl c Ar cachefile
1040 Reads configuration from the given
1041 .Ar cachefile
1042 that was created with the
1043 .Sy cachefile
1044 pool property.
1045 This
1046 .Ar cachefile
1047 is used instead of searching for devices.
1048 .It Fl d Ar dir
1049 Searches for devices or files in
1050 .Ar dir .
1051 The
1052 .Fl d
1053 option can be specified multiple times.
1054 .It Fl D
1055 Lists destroyed pools only.
1056 .El
1057 .It Xo
1058 .Nm
1059 .Cm import
1060 .Fl a
1061 .Op Fl DfmN
1062 .Op Fl F Op Fl n
1063 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1064 .Op Fl o Ar mntopts
1065 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1066 .Op Fl R Ar root
1067 .Xc
1068 Imports all pools found in the search directories.
1069 Identical to the previous command, except that all pools with a sufficient
1070 number of devices available are imported.
1071 Destroyed pools, pools that were previously destroyed with the
1072 .Nm zpool Cm destroy
1073 command, will not be imported unless the
1074 .Fl D
1075 option is specified.
1076 .Bl -tag -width Ds
1077 .It Fl a
1078 Searches for and imports all pools found.
1079 .It Fl c Ar cachefile
1080 Reads configuration from the given
1081 .Ar cachefile
1082 that was created with the
1083 .Sy cachefile
1084 pool property.
1085 This
1086 .Ar cachefile
1087 is used instead of searching for devices.
1088 .It Fl d Ar dir
1089 Searches for devices or files in
1090 .Ar dir .
1091 The
1092 .Fl d
1093 option can be specified multiple times.
1094 This option is incompatible with the
1095 .Fl c
1096 option.
1097 .It Fl D
1098 Imports destroyed pools only.
1099 The
1100 .Fl f
1101 option is also required.
1102 .It Fl f
1103 Forces import, even if the pool appears to be potentially active.
1104 .It Fl F
1105 Recovery mode for a non-importable pool.
1106 Attempt to return the pool to an importable state by discarding the last few
1107 transactions.
1108 Not all damaged pools can be recovered by using this option.
1109 If successful, the data from the discarded transactions is irretrievably lost.
1110 This option is ignored if the pool is importable or already imported.
1111 .It Fl m
1112 Allows a pool to import when there is a missing log device.
1113 Recent transactions can be lost because the log device will be discarded.
1114 .It Fl n
1115 Used with the
1116 .Fl F
1117 recovery option.
1118 Determines whether a non-importable pool can be made importable again, but does
1119 not actually perform the pool recovery.
1120 For more details about pool recovery mode, see the
1121 .Fl F
1122 option, above.
1123 .It Fl N
1124 Import the pool without mounting any file systems.
1125 .It Fl o Ar mntopts
1126 Comma-separated list of mount options to use when mounting datasets within the
1127 pool.
1128 See
1129 .Xr zfs 1M
1130 for a description of dataset properties and mount options.
1131 .It Fl o Ar property Ns = Ns Ar value
1132 Sets the specified property on the imported pool.
1133 See the
1134 .Sx Properties
1135 section for more information on the available pool properties.
1136 .It Fl R Ar root
1137 Sets the
1138 .Sy cachefile
1139 property to
1140 .Sy none
1141 and the
1142 .Sy altroot
1143 property to
1144 .Ar root .
1145 .El
1146 .It Xo
1147 .Nm
1148 .Cm import
1149 .Op Fl Dfm
1150 .Op Fl F Op Fl n
1151 .Op Fl c Ar cachefile Ns | Ns Fl d Ar dir
1152 .Op Fl o Ar mntopts
1153 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1154 .Op Fl R Ar root
1155 .Ar pool Ns | Ns Ar id
1156 .Op Ar newpool
1157 .Xc
1158 Imports a specific pool.
1159 A pool can be identified by its name or the numeric identifier.
1160 If
1161 .Ar newpool
1162 is specified, the pool is imported using the name
1163 .Ar newpool .
1164 Otherwise, it is imported with the same name as its exported name.
1165 .Pp
1166 If a device is removed from a system without running
1167 .Nm zpool Cm export
1168 first, the device appears as potentially active.
1169 It cannot be determined if this was a failed export, or whether the device is
1170 really in use from another host.
1171 To import a pool in this state, the
1172 .Fl f
1173 option is required.
1174 .Bl -tag -width Ds
1175 .It Fl c Ar cachefile
1176 Reads configuration from the given
1177 .Ar cachefile
1178 that was created with the
1179 .Sy cachefile
1180 pool property.
1181 This
1182 .Ar cachefile
1183 is used instead of searching for devices.
1184 .It Fl d Ar dir
1185 Searches for devices or files in
1186 .Ar dir .
1187 The
1188 .Fl d
1189 option can be specified multiple times.
1190 This option is incompatible with the
1191 .Fl c
1192 option.
1193 .It Fl D
1194 Imports destroyed pool.
1195 The
1196 .Fl f
1197 option is also required.
1198 .It Fl f
1199 Forces import, even if the pool appears to be potentially active.
1200 .It Fl F
1201 Recovery mode for a non-importable pool.
1202 Attempt to return the pool to an importable state by discarding the last few
1203 transactions.
1204 Not all damaged pools can be recovered by using this option.
1205 If successful, the data from the discarded transactions is irretrievably lost.
1206 This option is ignored if the pool is importable or already imported.
1207 .It Fl m
1208 Allows a pool to import when there is a missing log device.
1209 Recent transactions can be lost because the log device will be discarded.
1210 .It Fl n
1211 Used with the
1212 .Fl F
1213 recovery option.
1214 Determines whether a non-importable pool can be made importable again, but does
1215 not actually perform the pool recovery.
1216 For more details about pool recovery mode, see the
1217 .Fl F
1218 option, above.
1219 .It Fl o Ar mntopts
1220 Comma-separated list of mount options to use when mounting datasets within the
1221 pool.
1222 See
1223 .Xr zfs 1M
1224 for a description of dataset properties and mount options.
1225 .It Fl o Ar property Ns = Ns Ar value
1226 Sets the specified property on the imported pool.
1227 See the
1228 .Sx Properties
1229 section for more information on the available pool properties.
1230 .It Fl R Ar root
1231 Sets the
1232 .Sy cachefile
1233 property to
1234 .Sy none
1235 and the
1236 .Sy altroot
1237 property to
1238 .Ar root .
1239 .El
1240 .It Xo
1241 .Nm
1242 .Cm iostat
1243 .Op Fl v
1244 .Op Fl T Sy u Ns | Ns Sy d
1245 .Oo Ar pool Oc Ns ...
1246 .Op Ar interval Op Ar count
1247 .Xc
1248 Displays I/O statistics for the given pools.
1249 When given an
1250 .Ar interval ,
1251 the statistics are printed every
1252 .Ar interval
1253 seconds until ^C is pressed.
1254 If no
1255 .Ar pool Ns s
1256 are specified, statistics for every pool in the system is shown.
1257 If
1258 .Ar count
1259 is specified, the command exits after
1260 .Ar count
1261 reports are printed.
1262 .Bl -tag -width Ds
1263 .It Fl T Sy u Ns | Ns Sy d
1264 Display a time stamp.
1265 Specify
1266 .Sy u
1267 for a printed representation of the internal representation of time.
1268 See
1269 .Xr time 2 .
1270 Specify
1271 .Sy d
1272 for standard date format.
1273 See
1274 .Xr date 1 .
1275 .It Fl v
1276 Verbose statistics Reports usage statistics for individual vdevs within the
1277 pool, in addition to the pool-wide statistics.
1278 .El
1279 .It Xo
1280 .Nm
1281 .Cm labelclear
1282 .Op Fl f
1283 .Ar device
1284 .Xc
1285 Removes ZFS label information from the specified
1286 .Ar device .
1287 The
1288 .Ar device
1289 must not be part of an active pool configuration.
1290 .Bl -tag -width Ds
1291 .It Fl f
1292 Treat exported or foreign devices as inactive.
1293 .El
1294 .It Xo
1295 .Nm
1296 .Cm list
1297 .Op Fl Hpv
1298 .Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ...
1299 .Op Fl T Sy u Ns | Ns Sy d
1300 .Oo Ar pool Oc Ns ...
1301 .Op Ar interval Op Ar count
1302 .Xc
1303 Lists the given pools along with a health status and space usage.
1304 If no
1305 .Ar pool Ns s
1306 are specified, all pools in the system are listed.
1307 When given an
1308 .Ar interval ,
1309 the information is printed every
1310 .Ar interval
1311 seconds until ^C is pressed.
1312 If
1313 .Ar count
1314 is specified, the command exits after
1315 .Ar count
1316 reports are printed.
1317 .Bl -tag -width Ds
1318 .It Fl H
1319 Scripted mode.
1320 Do not display headers, and separate fields by a single tab instead of arbitrary
1321 space.
1322 .It Fl o Ar property
1323 Comma-separated list of properties to display.
1324 See the
1325 .Sx Properties
1326 section for a list of valid properties.
1327 The default list is
1328 .Cm name , size , allocated , free , expandsize , fragmentation , capacity ,
1329 .Cm dedupratio , health , altroot .
1330 .It Fl p
1331 Display numbers in parsable
1332 .Pq exact
1333 values.
1334 .It Fl T Sy u Ns | Ns Sy d
1335 Display a time stamp.
1336 Specify
1337 .Fl u
1338 for a printed representation of the internal representation of time.
1339 See
1340 .Xr time 2 .
1341 Specify
1342 .Fl d
1343 for standard date format.
1344 See
1345 .Xr date 1 .
1346 .It Fl v
1347 Verbose statistics.
1348 Reports usage statistics for individual vdevs within the pool, in addition to
1349 the pool-wise statistics.
1350 .El
1351 .It Xo
1352 .Nm
1353 .Cm offline
1354 .Op Fl t
1355 .Ar pool Ar device Ns ...
1356 .Xc
1357 Takes the specified physical device offline.
1358 While the
1359 .Ar device
1360 is offline, no attempt is made to read or write to the device.
1361 This command is not applicable to spares.
1362 .Bl -tag -width Ds
1363 .It Fl t
1364 Temporary.
1365 Upon reboot, the specified physical device reverts to its previous state.
1366 .El
1367 .It Xo
1368 .Nm
1369 .Cm online
1370 .Op Fl e
1371 .Ar pool Ar device Ns ...
1372 .Xc
1373 Brings the specified physical device online.
1374 This command is not applicable to spares.
1375 .Bl -tag -width Ds
1376 .It Fl e
1377 Expand the device to use all available space.
1378 If the device is part of a mirror or raidz then all devices must be expanded
1379 before the new space will become available to the pool.
1380 .El
1381 .It Xo
1382 .Nm
1383 .Cm reguid
1384 .Ar pool
1385 .Xc
1386 Generates a new unique identifier for the pool.
1387 You must ensure that all devices in this pool are online and healthy before
1388 performing this action.
1389 .It Xo
1390 .Nm
1391 .Cm reopen
1392 .Ar pool
1393 .Xc
1394 Reopen all the vdevs associated with the pool.
1395 .It Xo
1396 .Nm
1397 .Cm remove
1398 .Op Fl np
1399 .Ar pool Ar device Ns ...
1400 .Xc
1401 Removes the specified device from the pool.
1402 This command currently only supports removing hot spares, cache, log
1403 devices and mirrored top-level vdevs (mirror of leaf devices); but not raidz.
1404 .sp
1405 Removing a top-level vdev reduces the total amount of space in the storage pool.
1406 The specified device will be evacuated by copying all allocated space from it to
1407 the other devices in the pool.
1408 In this case, the
1409 .Nm zpool Cm remove
1410 command initiates the removal and returns, while the evacuation continues in
1411 the background.
1412 The removal progress can be monitored with
1413 .Nm zpool Cm status.
1414 This feature must be enabled to be used, see
1415 .Xr zpool-features 5
1416 .Pp
1417 A mirrored top-level device (log or data) can be removed by specifying the top-level mirror for the
1418 same.
1419 Non-log devices or data devices that are part of a mirrored configuration can be removed using
1420 the
1421 .Nm zpool Cm detach
1422 command.
1423 .Bl -tag -width Ds
1424 .It Fl n
1425 Do not actually perform the removal ("no-op").
1426 Instead, print the estimated amount of memory that will be used by the
1427 mapping table after the removal completes.
1428 This is nonzero only for top-level vdevs.
1429 .El
1430 .Bl -tag -width Ds
1431 .It Fl p
1432 Used in conjunction with the
1433 .Fl n
1434 flag, displays numbers as parsable (exact) values.
1435 .El
1436 .It Xo
1437 .Nm
1438 .Cm remove
1439 .Fl s
1440 .Ar pool
1441 .Xc
1442 Stops and cancels an in-progress removal of a top-level vdev.
1443 .It Xo
1444 .Nm
1445 .Cm replace
1446 .Op Fl f
1447 .Ar pool Ar device Op Ar new_device
1448 .Xc
1449 Replaces
1450 .Ar old_device
1451 with
1452 .Ar new_device .
1453 This is equivalent to attaching
1454 .Ar new_device ,
1455 waiting for it to resilver, and then detaching
1456 .Ar old_device .
1457 .Pp
1458 The size of
1459 .Ar new_device
1460 must be greater than or equal to the minimum size of all the devices in a mirror
1461 or raidz configuration.
1462 .Pp
1463 .Ar new_device
1464 is required if the pool is not redundant.
1465 If
1466 .Ar new_device
1467 is not specified, it defaults to
1468 .Ar old_device .
1469 This form of replacement is useful after an existing disk has failed and has
1470 been physically replaced.
1471 In this case, the new disk may have the same
1472 .Pa /dev/dsk
1473 path as the old device, even though it is actually a different disk.
1474 ZFS recognizes this.
1475 .Bl -tag -width Ds
1476 .It Fl f
1477 Forces use of
1478 .Ar new_device ,
1479 even if its appears to be in use.
1480 Not all devices can be overridden in this manner.
1481 .El
1482 .It Xo
1483 .Nm
1484 .Cm scrub
1485 .Op Fl s | Fl p
1486 .Ar pool Ns ...
1487 .Xc
1488 Begins a scrub or resumes a paused scrub.
1489 The scrub examines all data in the specified pools to verify that it checksums
1490 correctly.
1491 For replicated
1492 .Pq mirror or raidz
1493 devices, ZFS automatically repairs any damage discovered during the scrub.
1494 The
1495 .Nm zpool Cm status
1496 command reports the progress of the scrub and summarizes the results of the
1497 scrub upon completion.
1498 .Pp
1499 Scrubbing and resilvering are very similar operations.
1500 The difference is that resilvering only examines data that ZFS knows to be out
1501 of date
1502 .Po
1503 for example, when attaching a new device to a mirror or replacing an existing
1504 device
1505 .Pc ,
1506 whereas scrubbing examines all data to discover silent errors due to hardware
1507 faults or disk failure.
1508 .Pp
1509 Because scrubbing and resilvering are I/O-intensive operations, ZFS only allows
1510 one at a time.
1511 If a scrub is paused, the
1512 .Nm zpool Cm scrub
1513 resumes it.
1514 If a resilver is in progress, ZFS does not allow a scrub to be started until the
1515 resilver completes.
1516 .Bl -tag -width Ds
1517 .It Fl s
1518 Stop scrubbing.
1519 .El
1520 .Bl -tag -width Ds
1521 .It Fl p
1522 Pause scrubbing.
1523 Scrub pause state and progress are periodically synced to disk.
1524 If the system is restarted or pool is exported during a paused scrub,
1525 even after import, scrub will remain paused until it is resumed.
1526 Once resumed the scrub will pick up from the place where it was last
1527 checkpointed to disk.
1528 To resume a paused scrub issue
1529 .Nm zpool Cm scrub
1530 again.
1531 .El
1532 .It Xo
1533 .Nm
1534 .Cm set
1535 .Ar property Ns = Ns Ar value
1536 .Ar pool
1537 .Xc
1538 Sets the given property on the specified pool.
1539 See the
1540 .Sx Properties
1541 section for more information on what properties can be set and acceptable
1542 values.
1543 .It Xo
1544 .Nm
1545 .Cm split
1546 .Op Fl n
1547 .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ...
1548 .Op Fl R Ar root
1549 .Ar pool newpool
1550 .Xc
1551 Splits devices off
1552 .Ar pool
1553 creating
1554 .Ar newpool .
1555 All vdevs in
1556 .Ar pool
1557 must be mirrors.
1558 At the time of the split,
1559 .Ar newpool
1560 will be a replica of
1561 .Ar pool .
1562 .Bl -tag -width Ds
1563 .It Fl n
1564 Do dry run, do not actually perform the split.
1565 Print out the expected configuration of
1566 .Ar newpool .
1567 .It Fl o Ar property Ns = Ns Ar value
1568 Sets the specified property for
1569 .Ar newpool .
1570 See the
1571 .Sx Properties
1572 section for more information on the available pool properties.
1573 .It Fl R Ar root
1574 Set
1575 .Sy altroot
1576 for
1577 .Ar newpool
1578 to
1579 .Ar root
1580 and automatically import it.
1581 .El
1582 .It Xo
1583 .Nm
1584 .Cm status
1585 .Op Fl Dvx
1586 .Op Fl T Sy u Ns | Ns Sy d
1587 .Oo Ar pool Oc Ns ...
1588 .Op Ar interval Op Ar count
1589 .Xc
1590 Displays the detailed health status for the given pools.
1591 If no
1592 .Ar pool
1593 is specified, then the status of each pool in the system is displayed.
1594 For more information on pool and device health, see the
1595 .Sx Device Failure and Recovery
1596 section.
1597 .Pp
1598 If a scrub or resilver is in progress, this command reports the percentage done
1599 and the estimated time to completion.
1600 Both of these are only approximate, because the amount of data in the pool and
1601 the other workloads on the system can change.
1602 .Bl -tag -width Ds
1603 .It Fl D
1604 Display a histogram of deduplication statistics, showing the allocated
1605 .Pq physically present on disk
1606 and referenced
1607 .Pq logically referenced in the pool
1608 block counts and sizes by reference count.
1609 .It Fl T Sy u Ns | Ns Sy d
1610 Display a time stamp.
1611 Specify
1612 .Fl u
1613 for a printed representation of the internal representation of time.
1614 See
1615 .Xr time 2 .
1616 Specify
1617 .Fl d
1618 for standard date format.
1619 See
1620 .Xr date 1 .
1621 .It Fl v
1622 Displays verbose data error information, printing out a complete list of all
1623 data errors since the last complete pool scrub.
1624 .It Fl x
1625 Only display status for pools that are exhibiting errors or are otherwise
1626 unavailable.
1627 Warnings about pools not using the latest on-disk format will not be included.
1628 .El
1629 .It Xo
1630 .Nm
1631 .Cm upgrade
1632 .Xc
1633 Displays pools which do not have all supported features enabled and pools
1634 formatted using a legacy ZFS version number.
1635 These pools can continue to be used, but some features may not be available.
1636 Use
1637 .Nm zpool Cm upgrade Fl a
1638 to enable all features on all pools.
1639 .It Xo
1640 .Nm
1641 .Cm upgrade
1642 .Fl v
1643 .Xc
1644 Displays legacy ZFS versions supported by the current software.
1645 See
1646 .Xr zpool-features 5
1647 for a description of feature flags features supported by the current software.
1648 .It Xo
1649 .Nm
1650 .Cm upgrade
1651 .Op Fl V Ar version
1652 .Fl a Ns | Ns Ar pool Ns ...
1653 .Xc
1654 Enables all supported features on the given pool.
1655 Once this is done, the pool will no longer be accessible on systems that do not
1656 support feature flags.
1657 See
1658 .Xr zpool-features 5
1659 for details on compatibility with systems that support feature flags, but do not
1660 support all features enabled on the pool.
1661 .Bl -tag -width Ds
1662 .It Fl a
1663 Enables all supported features on all pools.
1664 .It Fl V Ar version
1665 Upgrade to the specified legacy version.
1666 If the
1667 .Fl V
1668 flag is specified, no features will be enabled on the pool.
1669 This option can only be used to increase the version number up to the last
1670 supported legacy version number.
1671 .El
1672 .El
1673 .Sh EXIT STATUS
1674 The following exit values are returned:
1675 .Bl -tag -width Ds
1676 .It Sy 0
1677 Successful completion.
1678 .It Sy 1
1679 An error occurred.
1680 .It Sy 2
1681 Invalid command line options were specified.
1682 .El
1683 .Sh EXAMPLES
1684 .Bl -tag -width Ds
1685 .It Sy Example 1 No Creating a RAID-Z Storage Pool
1686 The following command creates a pool with a single raidz root vdev that
1687 consists of six disks.
1688 .Bd -literal
1689 # zpool create tank raidz c0t0d0 c0t1d0 c0t2d0 c0t3d0 c0t4d0 c0t5d0
1690 .Ed
1691 .It Sy Example 2 No Creating a Mirrored Storage Pool
1692 The following command creates a pool with two mirrors, where each mirror
1693 contains two disks.
1694 .Bd -literal
1695 # zpool create tank mirror c0t0d0 c0t1d0 mirror c0t2d0 c0t3d0
1696 .Ed
1697 .It Sy Example 3 No Creating a ZFS Storage Pool by Using Slices
1698 The following command creates an unmirrored pool using two disk slices.
1699 .Bd -literal
1700 # zpool create tank /dev/dsk/c0t0d0s1 c0t1d0s4
1701 .Ed
1702 .It Sy Example 4 No Creating a ZFS Storage Pool by Using Files
1703 The following command creates an unmirrored pool using files.
1704 While not recommended, a pool based on files can be useful for experimental
1705 purposes.
1706 .Bd -literal
1707 # zpool create tank /path/to/file/a /path/to/file/b
1708 .Ed
1709 .It Sy Example 5 No Adding a Mirror to a ZFS Storage Pool
1710 The following command adds two mirrored disks to the pool
1711 .Em tank ,
1712 assuming the pool is already made up of two-way mirrors.
1713 The additional space is immediately available to any datasets within the pool.
1714 .Bd -literal
1715 # zpool add tank mirror c1t0d0 c1t1d0
1716 .Ed
1717 .It Sy Example 6 No Listing Available ZFS Storage Pools
1718 The following command lists all available pools on the system.
1719 In this case, the pool
1720 .Em zion
1721 is faulted due to a missing device.
1722 The results from this command are similar to the following:
1723 .Bd -literal
1724 # zpool list
1725 NAME    SIZE  ALLOC   FREE   FRAG  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
1726 rpool  19.9G  8.43G  11.4G    33%         -    42%  1.00x  ONLINE  -
1727 tank   61.5G  20.0G  41.5G    48%         -    32%  1.00x  ONLINE  -
1728 zion       -      -      -      -         -      -      -  FAULTED -
1729 .Ed
1730 .It Sy Example 7 No Destroying a ZFS Storage Pool
1731 The following command destroys the pool
1732 .Em tank
1733 and any datasets contained within.
1734 .Bd -literal
1735 # zpool destroy -f tank
1736 .Ed
1737 .It Sy Example 8 No Exporting a ZFS Storage Pool
1738 The following command exports the devices in pool
1739 .Em tank
1740 so that they can be relocated or later imported.
1741 .Bd -literal
1742 # zpool export tank
1743 .Ed
1744 .It Sy Example 9 No Importing a ZFS Storage Pool
1745 The following command displays available pools, and then imports the pool
1746 .Em tank
1747 for use on the system.
1748 The results from this command are similar to the following:
1749 .Bd -literal
1750 # zpool import
1751   pool: tank
1752     id: 15451357997522795478
1753  state: ONLINE
1754 action: The pool can be imported using its name or numeric identifier.
1755 config:
1756 
1757         tank        ONLINE
1758           mirror    ONLINE
1759             c1t2d0  ONLINE
1760             c1t3d0  ONLINE
1761 
1762 # zpool import tank
1763 .Ed
1764 .It Sy Example 10 No Upgrading All ZFS Storage Pools to the Current Version
1765 The following command upgrades all ZFS Storage pools to the current version of
1766 the software.
1767 .Bd -literal
1768 # zpool upgrade -a
1769 This system is currently running ZFS version 2.
1770 .Ed
1771 .It Sy Example 11 No Managing Hot Spares
1772 The following command creates a new pool with an available hot spare:
1773 .Bd -literal
1774 # zpool create tank mirror c0t0d0 c0t1d0 spare c0t2d0
1775 .Ed
1776 .Pp
1777 If one of the disks were to fail, the pool would be reduced to the degraded
1778 state.
1779 The failed device can be replaced using the following command:
1780 .Bd -literal
1781 # zpool replace tank c0t0d0 c0t3d0
1782 .Ed
1783 .Pp
1784 Once the data has been resilvered, the spare is automatically removed and is
1785 made available for use should another device fail.
1786 The hot spare can be permanently removed from the pool using the following
1787 command:
1788 .Bd -literal
1789 # zpool remove tank c0t2d0
1790 .Ed
1791 .It Sy Example 12 No Creating a ZFS Pool with Mirrored Separate Intent Logs
1792 The following command creates a ZFS storage pool consisting of two, two-way
1793 mirrors and mirrored log devices:
1794 .Bd -literal
1795 # zpool create pool mirror c0d0 c1d0 mirror c2d0 c3d0 log mirror \e
1796   c4d0 c5d0
1797 .Ed
1798 .It Sy Example 13 No Adding Cache Devices to a ZFS Pool
1799 The following command adds two disks for use as cache devices to a ZFS storage
1800 pool:
1801 .Bd -literal
1802 # zpool add pool cache c2d0 c3d0
1803 .Ed
1804 .Pp
1805 Once added, the cache devices gradually fill with content from main memory.
1806 Depending on the size of your cache devices, it could take over an hour for
1807 them to fill.
1808 Capacity and reads can be monitored using the
1809 .Cm iostat
1810 option as follows:
1811 .Bd -literal
1812 # zpool iostat -v pool 5
1813 .Ed
1814 .It Sy Example 14 No Removing a Mirrored top-level (Log or Data) Device
1815 The following commands remove the mirrored log device
1816 .Sy mirror-2
1817 and mirrored top-level data device
1818 .Sy mirror-1 .
1819 .Pp
1820 Given this configuration:
1821 .Bd -literal
1822   pool: tank
1823  state: ONLINE
1824  scrub: none requested
1825 config:
1826 
1827          NAME        STATE     READ WRITE CKSUM
1828          tank        ONLINE       0     0     0
1829            mirror-0  ONLINE       0     0     0
1830              c6t0d0  ONLINE       0     0     0
1831              c6t1d0  ONLINE       0     0     0
1832            mirror-1  ONLINE       0     0     0
1833              c6t2d0  ONLINE       0     0     0
1834              c6t3d0  ONLINE       0     0     0
1835          logs
1836            mirror-2  ONLINE       0     0     0
1837              c4t0d0  ONLINE       0     0     0
1838              c4t1d0  ONLINE       0     0     0
1839 .Ed
1840 .Pp
1841 The command to remove the mirrored log
1842 .Sy mirror-2
1843 is:
1844 .Bd -literal
1845 # zpool remove tank mirror-2
1846 .Ed
1847 .Pp
1848 The command to remove the mirrored data
1849 .Sy mirror-1
1850 is:
1851 .Bd -literal
1852 # zpool remove tank mirror-1
1853 .Ed
1854 .It Sy Example 15 No Displaying expanded space on a device
1855 The following command displays the detailed information for the pool
1856 .Em data .
1857 This pool is comprised of a single raidz vdev where one of its devices
1858 increased its capacity by 10GB.
1859 In this example, the pool will not be able to utilize this extra capacity until
1860 all the devices under the raidz vdev have been expanded.
1861 .Bd -literal
1862 # zpool list -v data
1863 NAME         SIZE  ALLOC   FREE   FRAG  EXPANDSZ    CAP  DEDUP  HEALTH  ALTROOT
1864 data        23.9G  14.6G  9.30G    48%         -    61%  1.00x  ONLINE  -
1865   raidz1    23.9G  14.6G  9.30G    48%         -
1866     c1t1d0      -      -      -      -         -
1867     c1t2d0      -      -      -      -       10G
1868     c1t3d0      -      -      -      -         -
1869 .Ed
1870 .El
1871 .Sh INTERFACE STABILITY
1872 .Sy Evolving
1873 .Sh SEE ALSO
1874 .Xr zfs 1M ,
1875 .Xr attributes 5 ,
1876 .Xr zpool-features 5