Module for managing BTRFS file systems.
salt.modules.btrfs.
add
(mountpoint, *devices, **kwargs)¶Add a devices to a BTRFS filesystem.
General options:
CLI Example:
salt '*' btrfs.add /mountpoint /dev/sda1 /dev/sda2
salt.modules.btrfs.
convert
(device, permanent=False, keeplf=False)¶Convert ext2/3/4 to BTRFS. Device should be mounted.
Filesystem can be converted temporarily so the further processing and rollback is possible, or permanently, where previous extended filesystem image gets deleted. Please note, permanent conversion takes a while as BTRFS filesystem needs to be properly rebalanced afterwards.
General options:
lost+found
of the partition (removed by default,CLI Example:
salt '*' btrfs.convert /dev/sda1
salt '*' btrfs.convert /dev/sda1 permanent=True
salt.modules.btrfs.
defragment
(path)¶Defragment mounted BTRFS filesystem. In order to defragment a filesystem, device should be properly mounted and writable.
If passed a device name, then defragmented whole filesystem, mounted on in. If passed a moun tpoint of the filesystem, then only this mount point is defragmented.
CLI Example:
salt '*' btrfs.defragment /dev/sda1
salt '*' btrfs.defragment /path/on/filesystem
salt.modules.btrfs.
delete
(mountpoint, *devices, **kwargs)¶Remove devices from a BTRFS filesystem.
CLI Example:
salt '*' btrfs.delete /mountpoint /dev/sda1 /dev/sda2
salt.modules.btrfs.
devices
()¶Get known BTRFS formatted devices on the system.
CLI Example:
salt '*' btrfs.devices
salt.modules.btrfs.
features
()¶List currently available BTRFS features.
CLI Example:
salt '*' btrfs.mkfs_features
salt.modules.btrfs.
info
(device)¶Get BTRFS filesystem information.
CLI Example:
salt '*' btrfs.info /dev/sda1
salt.modules.btrfs.
mkfs
(*devices, **kwargs)¶Create a file system on the specified device. By default wipes out with force.
General options:
Options:
salt <host> btrfs.features
for full list of available features)See the mkfs.btrfs(8)
manpage for a more complete description of corresponding options description.
CLI Example:
salt '*' btrfs.mkfs /dev/sda1
salt '*' btrfs.mkfs /dev/sda1 noforce=True
salt.modules.btrfs.
properties
(obj, type=None, set=None)¶List properties for given btrfs object. The object can be path of BTRFS device, mount point, or any directories/files inside the BTRFS filesystem.
General options:
CLI Example:
salt '*' btrfs.properties /mountpoint
salt '*' btrfs.properties /dev/sda1 type=subvol set='ro=false,label="My Storage"'
salt.modules.btrfs.
resize
(mountpoint, size)¶Resize filesystem.
General options:
CLI Example:
salt '*' btrfs.resize /mountpoint size=+1g
salt '*' btrfs.resize /dev/sda1 size=max
salt.modules.btrfs.
subvolume_create
(name, dest=None, qgroupids=None)¶Create subvolume name in dest.
Return True if the subvolume is created, False is the subvolume is already there.
CLI Example:
salt '*' btrfs.subvolume_create var
salt '*' btrfs.subvolume_create var dest=/mnt
salt '*' btrfs.subvolume_create var qgroupids='[200]'
salt.modules.btrfs.
subvolume_delete
(name=None, names=None, commit=None)¶Delete the subvolume(s) from the filesystem
The user can remove one single subvolume (name) or multiple of then at the same time (names). One of the two parameters needs to specified.
Please, refer to the documentation to understand the implication on the transactions, and when the subvolume is really deleted.
Return True if the subvolume is deleted, False is the subvolume was already missing.
CLI Example:
salt '*' btrfs.subvolume_delete /var/volumes/tmp
salt '*' btrfs.subvolume_delete /var/volumes/tmp commit=after
salt.modules.btrfs.
subvolume_exists
(path)¶Check if a subvolume is present in the filesystem.
CLI Example:
salt '*' btrfs.subvolume_exists /mnt/var
salt.modules.btrfs.
subvolume_find_new
(name, last_gen)¶List the recently modified files in a subvolume
CLI Example:
salt '*' btrfs.subvolume_find_new /var/volumes/tmp 1024
salt.modules.btrfs.
subvolume_get_default
(path)¶Get the default subvolume of the filesystem path
CLI Example:
salt '*' btrfs.subvolume_get_default /var/volumes/tmp
salt.modules.btrfs.
subvolume_list
(path, parent_id=False, absolute=False, ogeneration=False, generation=False, subvolumes=False, uuid=False, parent_uuid=False, sent_subvolume_uuid=False, snapshots=False, readonly=False, deleted=False, generation_cmp=None, ogeneration_cmp=None, sort=None)¶List the subvolumes present in the filesystem.
CLI Example:
salt '*' btrfs.subvolume_list /var/volumes/tmp
salt '*' btrfs.subvolume_list /var/volumes/tmp path=True
salt '*' btrfs.subvolume_list /var/volumes/tmp sort='[-rootid]'
salt.modules.btrfs.
subvolume_set_default
(subvolid, path)¶Set the subvolume as default
CLI Example:
salt '*' btrfs.subvolume_set_default 257 /var/volumes/tmp
salt.modules.btrfs.
subvolume_show
(path)¶Show information of a given subvolume
CLI Example:
salt '*' btrfs.subvolume_show /var/volumes/tmp
salt.modules.btrfs.
subvolume_snapshot
(source, dest=None, name=None, read_only=False)¶Create a snapshot of a source subvolume
CLI Example:
salt '*' btrfs.subvolume_snapshot /var/volumes/tmp dest=/.snapshots
salt '*' btrfs.subvolume_snapshot /var/volumes/tmp name=backup
salt.modules.btrfs.
subvolume_sync
(path, subvolids=None, sleep=None)¶Wait until given subvolume are completely removed from the filesystem after deletion.
CLI Example:
salt '*' btrfs.subvolume_sync /var/volumes/tmp
salt '*' btrfs.subvolume_sync /var/volumes/tmp subvolids='[257]'
salt.modules.btrfs.
usage
(path)¶Show in which disk the chunks are allocated.
CLI Example:
salt '*' btrfs.usage /your/mountpoint
salt.modules.btrfs.
version
()¶Return BTRFS version.
CLI Example:
salt '*' btrfs.version
Docs for previous releases are available on readthedocs.org.
Latest Salt release: latest_release