salt.modules.zpool

Module for running ZFS zpool command

codeauthor:Nitin Madhok <nmadhok@clemson.edu>
salt.modules.zpool.add(pool_name, *vdevs)

Add the specified vdev's to the given pool

CLI Example:

salt '*' zpool.add myzpool /path/to/vdev1 /path/to/vdev2 [...]
salt.modules.zpool.create(pool_name, *vdevs, **kwargs)

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

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]

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.create myzpool /path/to/vdev1 [...] properties="{'property1': 'value1', 'property2': 'value2'}"
salt.modules.zpool.create_file_vdev(size, *vdevs)

Creates file based virtual devices for a zpool

*vdevs is a list of full paths for mkfile to create

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.

salt.modules.zpool.destroy(pool_name)

Destroys a storage pool

CLI Example:

salt '*' zpool.destroy myzpool
salt.modules.zpool.exists(pool_name)

Check if a ZFS storage pool is active

CLI Example:

salt '*' zpool.exists myzpool
salt.modules.zpool.export(*pools, **kwargs)

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]
salt.modules.zpool.import(pool_name='', new_name='', **kwargs)

New in version 2015.5.0.

Import storage pools or list pools available for import

CLI Example:

salt '*' zpool.import [all=True|False]
salt '*' zpool.import myzpool [mynewzpool] [force=True|False]
salt.modules.zpool.iostat(name='')

Display I/O statistics for the given pools

CLI Example:

salt '*' zpool.iostat myzpool
salt.modules.zpool.list()

New in version 2015.5.0.

Return a list of all pools in the system with health status and space usage

CLI Example:

salt '*' zpool.list
salt.modules.zpool.offline(pool_name, *vdevs, **kwargs)

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]
salt.modules.zpool.online(pool_name, *vdevs, **kwargs)

New in version 2015.5.0.

Ensure that the specified devices are online

CLI Example:

salt '*' zpool.online myzpool /path/to/vdev1 [...]
salt.modules.zpool.replace(pool_name, old, new)

Replaces old device with new device.

CLI Example:

salt '*' zpool.replace myzpool /path/to/vdev1 /path/to/vdev2
salt.modules.zpool.scrub(pool_name=None)

Begin a scrub

CLI Example:

salt '*' zpool.scrub myzpool
salt.modules.zpool.status(name='')

Return the status of the named zpool

CLI Example:

salt '*' zpool.status myzpool
salt.modules.zpool.zpool_list()

Deprecated since version 2014.7.0: Use list_() instead.

Return a list of all pools in the system with health status and space usage

CLI Example:

salt '*' zpool.zpool_list