Module for running ZFS zpool command
codeauthor: | Nitin Madhok <nmadhok@clemson.edu>, Jorge Schrauwen <sjorge@blackdot.be> |
---|---|
maintainer: | Jorge Schrauwen <sjorge@blackdot.be> |
maturity: | new |
depends: | salt.utils.zfs |
platform: | illumos,freebsd,linux |
Changed in version 2018.3.1: Big refactor to remove duplicate code, better type converions and improved consistancy in output.
Add the specified vdev's to the given storage pool
CLI Example:
salt '*' zpool.add myzpool /path/to/vdev1 /path/to/vdev2 [...]
Attach specified device to zpool
device
)CLI Example:
salt '*' zpool.attach myzpool /path/to/vdev1 /path/to/vdev2 [...]
Clears device errors in a pool.
Warning
The device must not be part of an active pool configuration.
New in version 2018.3.1.
CLI Example:
salt '*' zpool.clear mypool salt '*' zpool.clear mypool /path/to/dev
New in version 2015.5.0.
Create a simple zpool, a mirrored zpool, a zpool having nested VDEVs, a hybrid zpool with cache, spare and log drives or a zpool with RAIDZ-1, RAIDZ-2 or RAIDZ-3
create a boot partition
New in version 2018.3.0.
CLI Examples:
salt '*' zpool.create myzpool /path/to/vdev1 [...] [force=True|False] salt '*' zpool.create myzpool mirror /path/to/vdev1 /path/to/vdev2 [...] [force=True|False] salt '*' zpool.create myzpool raidz1 /path/to/vdev1 /path/to/vdev2 raidz2 /path/to/vdev3 /path/to/vdev4 /path/to/vdev5 [...] [force=True|False] salt '*' zpool.create myzpool mirror /path/to/vdev1 [...] mirror /path/to/vdev2 /path/to/vdev3 [...] [force=True|False] salt '*' zpool.create myhybridzpool mirror /tmp/file1 [...] log mirror /path/to/vdev1 [...] cache /path/to/vdev2 [...] spare /path/to/vdev3 [...] [force=True|False]
Note
Zpool properties can be specified at the time of creation of the pool by passing an additional argument called "properties" and specifying the properties with their respective values in the form of a python dictionary:
properties="{'property1': 'value1', 'property2': 'value2'}"
Filesystem properties can be specified at the time of creation of the pool by passing an additional argument called "filesystem_properties" and specifying the properties with their respective values in the form of a python dictionary:
filesystem_properties="{'property1': 'value1', 'property2': 'value2'}"
Example:
salt '*' zpool.create myzpool /path/to/vdev1 [...] properties="{'property1': 'value1', 'property2': 'value2'}"
CLI Example:
salt '*' zpool.create myzpool /path/to/vdev1 [...] [force=True|False] salt '*' zpool.create myzpool mirror /path/to/vdev1 /path/to/vdev2 [...] [force=True|False] salt '*' zpool.create myzpool raidz1 /path/to/vdev1 /path/to/vdev2 raidz2 /path/to/vdev3 /path/to/vdev4 /path/to/vdev5 [...] [force=True|False] salt '*' zpool.create myzpool mirror /path/to/vdev1 [...] mirror /path/to/vdev2 /path/to/vdev3 [...] [force=True|False] salt '*' zpool.create myhybridzpool mirror /tmp/file1 [...] log mirror /path/to/vdev1 [...] cache /path/to/vdev2 [...] spare /path/to/vdev3 [...] [force=True|False]
Creates file based virtual devices for a zpool
CLI Example:
salt '*' zpool.create_file_vdev 7G /path/to/vdev1 [/path/to/vdev2] [...]
Note
Depending on file size, the above command may take a while to return.
Destroys a storage pool
CLI Example:
salt '*' zpool.destroy myzpool
Detach specified device to zpool
CLI Example:
salt '*' zpool.detach myzpool /path/to/vdev1
Check if a ZFS storage pool is active
CLI Example:
salt '*' zpool.exists myzpool
New in version 2015.5.0.
Export storage pools
CLI Example:
salt '*' zpool.export myzpool ... [force=True|False] salt '*' zpool.export myzpool2 myzpool2 ... [force=True|False]
New in version 2016.3.0.
Retrieves the given list of properties
Display numbers in parsable (exact) values
New in version 2018.3.0.
CLI Example:
salt '*' zpool.get myzpool
Check if all zpools are healthy
New in version 2016.3.0.
CLI Example:
salt '*' zpool.healthy
New in version 2016.3.0.
Displays the command history of the specified pools, or all pools if no pool is specified
CLI Example:
salt '*' zpool.upgrade myzpool
New in version 2015.5.0.
Import storage pools or list pools available for import
dir="dir1,dir2"
force=True
.false: do not try to recovery broken pools true: try to recovery the pool by rolling back the latest transactions test: check if a pool can be recovered, but don't import it nolog: allow import without log device, recent transactions might be lost
Note
If feature flags are not support this forced to the default of 'false'
Warning
When recovery is set to 'test' the result will be have imported set to True if the pool can be imported. The pool might also be imported if the pool was not broken to begin with.
Note
Zpool properties can be specified at the time of creation of the pool by passing an additional argument called "properties" and specifying the properties with their respective values in the form of a python dictionary:
properties="{'property1': 'value1', 'property2': 'value2'}"
CLI Example:
salt '*' zpool.import [force=True|False] salt '*' zpool.import myzpool [mynewzpool] [force=True|False] salt '*' zpool.import myzpool dir='/tmp'
Display I/O statistics for the given pools
New in version 2016.3.0.
Changed in version 2018.3.1: Added `parsable`
parameter that defaults to True
CLI Example:
salt '*' zpool.iostat myzpool
New in version 2018.3.0.
Removes ZFS label information from the specified device
CLI Example:
salt '*' zpool.labelclear /path/to/dev
New in version 2015.5.0.
Return information about (all) storage pools
display numbers in parsable (exact) values
New in version 2018.3.0.
Note
The name
property will always be included, while the frag
property will get removed if not available
Note
Multiple storage pool can be provded as a space separated list
CLI Example:
salt '*' zpool.list salt '*' zpool.list zpool=tank salt '*' zpool.list 'size,free' salt '*' zpool.list 'size,free' tank
New in version 2015.5.0.
Ensure that the specified devices are offline
Warning
By default, the OFFLINE
state is persistent. The device remains offline when the system is rebooted. To temporarily take a device offline, use temporary=True
.
CLI Example:
salt '*' zpool.offline myzpool /path/to/vdev1 [...] [temporary=True|False]
New in version 2015.5.0.
Ensure that the specified devices are online
Expand the device to use all available space.
Note
If the device is part of a mirror or raidz then all devices must be expanded before the new space will become available to the pool.
CLI Example:
salt '*' zpool.online myzpool /path/to/vdev1 [...]
Generates a new unique identifier for the pool
Warning
You must ensure that all devices in this pool are online and healthy before performing this action.
New in version 2016.3.0.
CLI Example:
salt '*' zpool.reguid myzpool
Reopen all the vdevs associated with the pool
New in version 2016.3.0.
CLI Example:
salt '*' zpool.reopen myzpool
Replaces old_device
with new_device
Note
This is equivalent to attaching new_device
, waiting for it to resilver, and then detaching old_device
.
The size of new_device
must be greater than or equal to the minimum size of all the devices in a mirror or raidz configuration.
CLI Example:
salt '*' zpool.replace myzpool /path/to/vdev1 /path/to/vdev2
Scrub a storage pool
True
, cancel ongoing scrubIf True
, pause ongoing scrub
New in version 2018.3.0.
Note
Pause is only available on recent versions of ZFS.
If both pause
and stop
are True
, then stop
will win.
CLI Example:
salt '*' zpool.scrub myzpool
Sets the given property on the specified pool
New in version 2016.3.0.
CLI Example:
salt '*' zpool.set myzpool readonly yes
New in version 2018.3.0.
Splits devices off pool creating newpool.
Note
All vdevs in pool must be mirrors. At the time of the split, newzpool
will be a replica of zpool
.
After splitting, do not forget to import the new pool!
CLI Examples:
salt '*' zpool.split datamirror databackup salt '*' zpool.split datamirror databackup altroot=/backup
Note
Zpool properties can be specified at the time of creation of the pool by passing an additional argument called "properties" and specifying the properties with their respective values in the form of a python dictionary:
properties="{'property1': 'value1', 'property2': 'value2'}"
Example:
salt '*' zpool.split datamirror databackup properties="{'readonly': 'on'}"
CLI Example:
salt '*' zpool.split datamirror databackup salt '*' zpool.split datamirror databackup altroot=/backup
Return the status of the named zpool
New in version 2016.3.0.
CLI Example:
salt '*' zpool.status myzpool
New in version 2016.3.0.
Enables all supported features on the given pool
Warning
Once this is done, the pool will no longer be accessible on systems that do not support feature flags. See zpool-features(5) for details on compatibility with systems that support feature flags, but do not support all features enabled on the pool.
CLI Example:
salt '*' zpool.upgrade myzpool
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.zpool.html