ZPOOL(8) | System Manager's Manual | ZPOOL(8) |
zpool
— configure
ZFS storage pools
zpool |
-?V |
zpool |
version |
zpool |
<subcommand>
[<args>] |
The zpool
command configures ZFS storage
pools. A storage pool is a collection of devices that provides physical
storage and data replication for ZFS datasets. All datasets within a storage
pool share the same space. See zfs(8) for information on
managing datasets.
For an overview of creating and managing ZFS storage pools see the zpoolconcepts(8) manual page.
All subcommands that modify state are logged persistently to the pool in their original form.
The zpool
command provides subcommands to
create and destroy storage pools, add capacity to storage pools, and provide
information about the storage pools. The following subcommands are
supported:
zpool
-
?zpool
-V,
--version
zpool
version
subcommand.zpool
version
zpool
userland utility and the zfs kernel module.attach
-ing or
detach
-ing a device on an existing vdev (virtual
device).Available pool properties listed in the zpoolprops(8) manual page.
zpool
import
--rewind-to-checkpoint
.The following exit values are returned:
# zpool create tank raidz sda sdb sdc sdd sde sdf
# zpool create tank mirror sda sdb mirror sdc sdd
# zpool create tank sda1 sdb2
# zpool create tank /path/to/file/a /path/to/file/b
# zpool add tank mirror sda sdb
# zpool list NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT rpool 19.9G 8.43G 11.4G - 33% 42% 1.00x ONLINE - tank 61.5G 20.0G 41.5G - 48% 32% 1.00x ONLINE - zion - - - - - - - FAULTED -
# zpool destroy -f tank
# zpool export tank
# zpool import pool: tank id: 15451357997522795478 state: ONLINE action: The pool can be imported using its name or numeric identifier. config: tank ONLINE mirror ONLINE sda ONLINE sdb ONLINE # zpool import tank
# zpool upgrade -a This system is currently running ZFS version 2.
# zpool create tank mirror sda sdb spare sdc
If one of the disks were to fail, the pool would be reduced to the degraded state. The failed device can be replaced using the following command:
# zpool replace tank sda sdd
Once the data has been resilvered, the spare is automatically removed and is made available for use should another device fail. The hot spare can be permanently removed from the pool using the following command:
# zpool remove tank sdc
# zpool create pool mirror sda sdb mirror sdc sdd log mirror \ sde sdf
# zpool add pool cache sdc sdd
Once added, the cache devices gradually fill with content from
main memory. Depending on the size of your cache devices, it could take
over an hour for them to fill. Capacity and reads can be monitored using
the iostat
option as follows:
# zpool iostat -v pool 5
Given this configuration:
pool: tank state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 sda ONLINE 0 0 0 sdb ONLINE 0 0 0 mirror-1 ONLINE 0 0 0 sdc ONLINE 0 0 0 sdd ONLINE 0 0 0 logs mirror-2 ONLINE 0 0 0 sde ONLINE 0 0 0 sdf ONLINE 0 0 0
The command to remove the mirrored log mirror-2 is:
# zpool remove tank mirror-2
The command to remove the mirrored data mirror-1 is:
# zpool remove tank mirror-1
# zpool list -v data NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT data 23.9G 14.6G 9.30G - 48% 61% 1.00x ONLINE - raidz1 23.9G 14.6G 9.30G - 48% sda - - - - - sdb - - - 10G - sdc - - - - -
zpool
status
and zpool
iostat
output with -c
option.
# zpool status -c vendor,model,size NAME STATE READ WRITE CKSUM vendor model size tank ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 U1 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U10 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U11 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U12 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T # zpool iostat -vc size capacity operations bandwidth pool alloc free read write read write size ---------- ----- ----- ----- ----- ----- ----- ---- rpool 14.6G 54.9G 4 55 250K 2.69M sda1 14.6G 54.9G 4 55 250K 2.69M 70G ---------- ----- ----- ----- ----- ----- ----- ----
ZFS_ABORT
zpool
to dump core on exit for the purposes
of running
::findleaks.ZFS_COLOR
zpool status
output.ZPOOL_IMPORT_PATH
zpool
looks for device nodes and files. Similar to the
-d
option in zpool
import
.ZPOOL_IMPORT_UDEV_TIMEOUT_MS
zpool import
will wait for an expected device to be available.ZPOOL_STATUS_NON_NATIVE_ASHIFT_IGNORE
zpool status
. The value is not used, only the
presence or absence of the variable matters.ZPOOL_VDEV_NAME_GUID
zpool
subcommands to output vdev guids by
default. This behavior is identical to the zpool status
-g
command line option.ZPOOL_VDEV_NAME_FOLLOW_LINKS
zpool
subcommands to follow links for vdev
names by default. This behavior is identical to the zpool
status -L
command line option.ZPOOL_VDEV_NAME_PATH
zpool
subcommands to output full vdev path
names by default. This behavior is identical to the zpool
status -P
command line option.ZFS_VDEV_DEVID_OPT_OUT
For example, a pool that originated on illumos platform would
have a devid value in the config and zpool
status
would fail when listing the config. This would also be
true for future Linux based pools.
A pool can be stripped of any devid values
on import or prevented from adding them on zpool
create
or zpool add
by setting
ZFS_VDEV_DEVID_OPT_OUT.
ZPOOL_SCRIPTS_AS_ROOT
zpool
status/iostat
with the -c
option. Normally,
only unprivileged users are allowed to run
-c
.ZPOOL_SCRIPTS_PATH
zpool
status/iostat
with the -c
option. This is a
colon-separated list of directories and overrides the default
~/.zpool.d and
/etc/zfs/zpool.d search paths.ZPOOL_SCRIPTS_ENABLED
zpool status/iostat
with the
-c
option. If
ZPOOL_SCRIPTS_ENABLED is not set, it is assumed that the
user is allowed to run zpool status/iostat
-c
.zfs-events(5), zfs-module-parameters(5), zpool-features(5), zed(8), zfs(8), zpool-add(8), zpool-attach(8), zpool-checkpoint(8), zpool-clear(8), zpool-create(8), zpool-destroy(8), zpool-detach(8), zpool-events(8), zpool-export(8), zpool-get(8), zpool-history(8), zpool-import(8), zpool-initialize(8), zpool-iostat(8), zpool-labelclear(8), zpool-list(8), zpool-offline(8), zpool-online(8), zpool-reguid(8), zpool-remove(8), zpool-reopen(8), zpool-replace(8), zpool-resilver(8), zpool-scrub(8), zpool-set(8), zpool-split(8), zpool-status(8), zpool-sync(8), zpool-trim(8), zpool-upgrade(8), zpool-wait(8), zpoolconcepts(8), zpoolprops(8)
August 9, 2019 | Linux |