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