Chapter 17. Managing layered local storage with Stratis
You can easily set up and manage complex storage configurations integrated by the Stratis high-level system.
Stratis is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview.
17.1. Setting up Stratis file systems
As a system administrator, you can enable and set up the Stratis volume-managing file system on your system to easily manage layered storage.
17.1.1. The purpose and features of Stratis
Stratis is a local storage-management solution for Linux. It is focused on simplicity and ease of use, and gives you access to advanced storage features.
Stratis makes the following activities easier:
- Initial configuration of storage
- Making changes later
- Using advanced storage features
Stratis is a hybrid user-and-kernel local storage management system that supports advanced storage features. The central concept of Stratis is a storage pool. This pool is created from one or more local disks or partitions, and volumes are created from the pool.
The pool enables many useful features, such as:
- File system snapshots
- Thin provisioning
- Tiering
17.1.2. Components of a Stratis volume
Externally, Stratis presents the following volume components in the command-line interface and the API:
blockdev
- Block devices, such as a disk or a disk partition.
pool
Composed of one or more block devices.
A pool has a fixed total size, equal to the size of the block devices.
The pool contains most Stratis layers, such as the non-volatile data cache using the
dm-cache
target.Stratis creates a
/stratis/my-pool/
directory for each pool. This directory contains links to devices that represent Stratis file systems in the pool.
filesystem
Each pool can contain one or more file systems, which store files.
File systems are thinly provisioned and do not have a fixed total size. The actual size of a file system grows with the data stored on it. If the size of the data approaches the virtual size of the file system, Stratis grows the thin volume and the file system automatically.
The file systems are formatted with XFS.
ImportantStratis tracks information about file systems created using Stratis that XFS is not aware of, and changes made using XFS do not automatically create updates in Stratis. Users must not reformat or reconfigure XFS file systems that are managed by Stratis.
Stratis creates links to file systems at the
/stratis/my-pool/my-fs
path.
Stratis uses many Device Mapper devices, which show up in dmsetup
listings and the /proc/partitions
file. Similarly, the lsblk
command output reflects the internal workings and layers of Stratis.
17.1.3. Block devices usable with Stratis
This section lists storage devices that you can use for Stratis.
Supported devices
Stratis pools have been tested to work on these types of block devices:
- LUKS
- LVM logical volumes
- MD RAID
- DM Multipath
- iSCSI
- HDDs and SSDs
- NVMe devices
In the current version, Stratis does not handle failures in hard drives or other hardware. If you create a Stratis pool over multiple hardware devices, you increase the risk of data loss because multiple devices must be operational to access the data.
Unsupported devices
Because Stratis contains a thin-provisioning layer, Red Hat does not recommend placing a Stratis pool on block devices that are already thinly-provisioned.
Additional resources
-
For iSCSI and other block devices requiring network, see the
systemd.mount(5)
man page for information on the_netdev
mount option.
17.1.4. Installing Stratis
This procedure installs all packages necessary to use Stratis.
Procedure
Install packages that provide the Stratis service and command-line utilities:
# yum install stratisd stratis-cli
Make sure that the
stratisd
service is enabled:# systemctl enable --now stratisd
17.1.5. Creating a Stratis pool
This procedure describes how to create an encrypted or an unencrypted Stratis pool from one or more block devices.
The following notes apply to encrypted Stratis pools:
-
Each block device is encrypted using the
cryptsetup
library and implements theLUKS2
format. - Each Stratis pool can have a unique key or it can share the same key with other pools. These keys are stored in the kernel keyring.
- All block devices that comprise a Stratis pool are either encrypted or unencrypted. It is not possible to have both encrypted and unencrypted block devices in the same Stratis pool.
- Block devices added to the data tier of an encrypted Stratis pool are automatically encrypted.
Prerequisites
- Stratis v2.2.1 is installed on your system. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - The block devices on which you are creating a Stratis pool are not in use and are not mounted.
- The block devices on which you are creating a Stratis pool are at least 1 GiB in size each.
On the IBM Z architecture, the
/dev/dasd*
block devices must be partitioned. Use the partition in the Stratis pool.For information on partitioning DASD devices, see Configuring a Linux instance on IBM Z.
Procedure
If the selected block device contains file system, partition table, or RAID signatures, erase them using the following command:
# wipefs --all block-device
where
block-device
is the path to the block device; for example,/dev/sdb
.Create the new Stratis pool on the selected block device(s):
NoteSpecify multiple block devices on a single line, separated by a space:
# stratis pool create my-pool block-device-1 block-device-2
To create an unencrypted Stratis pool, use the following command and go to step 3:
# stratis pool create my-pool block-device
where
block-device
is the path to an empty or wiped block device.NoteYou cannot encrypt an unencrypted Stratis pool after you create it.
To create an encrypted Stratis pool, complete the following steps:
If you have not created a key set already, run the following command and follow the prompts to create a key set to use for the encryption:
# stratis key set --capture-key key-description
where
key-description
is the description or name of the key set.Create the encrypted Stratis pool and specify the key description to use for the encryption. You can also specify the key path using the
--keyfile-path
parameter instead.# stratis pool create --key-desc key-description my-pool block-device
where
key-description
- Specifies the description or name of the key file to be used for the encryption.
my-pool
- Specifies the name of the new Stratis pool.
block-device
- Specifies the path to an empty or wiped block device.
Verify that the new Stratis pool was created:
# stratis pool list
Troubleshooting
After a system reboot, sometimes you might not see your encrypted Stratis pool or the block devices that comprise it. If you encounter this issue, you must unlock the Stratis pool to make it visible.
To unlock the Stratis pool, complete the following steps:
Recreate the key set using the same key description that was used previously:
# stratis key set --capture-key key-description
Unlock the Stratis pool and the block device(s):
# stratis pool unlock
Verify that the Stratis pool is visible:
# stratis pool list
Additional resources
-
The
stratis(8)
man page.
Next steps
- Create a Stratis file system on the pool. For more information, see Section 17.1.6, “Creating a Stratis file system”.
17.1.6. Creating a Stratis file system
This procedure creates a Stratis file system on an existing Stratis pool.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis pool. See Section 17.1.5, “Creating a Stratis pool”.
Procedure
To create a Stratis file system on a pool, use:
# stratis fs create my-pool my-fs
- Replace my-pool with the name of your existing Stratis pool.
- Replace my-fs with an arbitrary name for the file system.
To verify, list file systems within the pool:
# stratis fs list my-pool
Additional resources
-
The
stratis(8)
man page
Next steps
- Mount the Stratis file system. See Section 17.1.7, “Mounting a Stratis file system”.
17.1.7. Mounting a Stratis file system
This procedure mounts an existing Stratis file system to access the content.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis file system. See Section 17.1.6, “Creating a Stratis file system”.
Procedure
To mount the file system, use the entries that Stratis maintains in the
/stratis/
directory:# mount /stratis/my-pool/my-fs mount-point
The file system is now mounted on the mount-point directory and ready to use.
Additional resources
-
The
mount(8)
man page
17.1.8. Persistently mounting a Stratis file system
This procedure persistently mounts a Stratis file system so that it is available automatically after booting the system.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis file system. See Section 17.1.6, “Creating a Stratis file system”.
Procedure
Determine the UUID attribute of the file system:
$ lsblk --output=UUID /stratis/my-pool/my-fs
For example:
Example 17.1. Viewing the UUID of Stratis file system
$ lsblk --output=UUID /stratis/my-pool/fs1 UUID a1f0b64a-4ebb-4d4e-9543-b1d79f600283
If the mount point directory does not exist, create it:
# mkdir --parents mount-point
As root, edit the
/etc/fstab
file and add a line for the file system, identified by the UUID. Usexfs
as the file system type and add thex-systemd.requires=stratisd.service
option.For example:
Example 17.2. The /fs1 mount point in /etc/fstab
UUID=a1f0b64a-4ebb-4d4e-9543-b1d79f600283 /fs1 xfs defaults,x-systemd.requires=stratisd.service 0 0
Regenerate mount units so that your system registers the new configuration:
# systemctl daemon-reload
Try mounting the file system to verify that the configuration works:
# mount mount-point
Additional resources
17.2. Extending a Stratis volume with additional block devices
You can attach additional block devices to a Stratis pool to provide more storage capacity for Stratis file systems.
17.2.1. Components of a Stratis volume
Externally, Stratis presents the following volume components in the command-line interface and the API:
blockdev
- Block devices, such as a disk or a disk partition.
pool
Composed of one or more block devices.
A pool has a fixed total size, equal to the size of the block devices.
The pool contains most Stratis layers, such as the non-volatile data cache using the
dm-cache
target.Stratis creates a
/stratis/my-pool/
directory for each pool. This directory contains links to devices that represent Stratis file systems in the pool.
filesystem
Each pool can contain one or more file systems, which store files.
File systems are thinly provisioned and do not have a fixed total size. The actual size of a file system grows with the data stored on it. If the size of the data approaches the virtual size of the file system, Stratis grows the thin volume and the file system automatically.
The file systems are formatted with XFS.
ImportantStratis tracks information about file systems created using Stratis that XFS is not aware of, and changes made using XFS do not automatically create updates in Stratis. Users must not reformat or reconfigure XFS file systems that are managed by Stratis.
Stratis creates links to file systems at the
/stratis/my-pool/my-fs
path.
Stratis uses many Device Mapper devices, which show up in dmsetup
listings and the /proc/partitions
file. Similarly, the lsblk
command output reflects the internal workings and layers of Stratis.
17.2.2. Adding block devices to a Stratis pool
This procedure adds one or more block devices to a Stratis pool to be usable by Stratis file systems.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - The block devices that you are adding to the Stratis pool are not in use and not mounted.
- The block devices that you are adding to the Stratis pool are at least 1 GiB in size each.
Procedure
To add one or more block devices to the pool, use:
# stratis pool add-data my-pool device-1 device-2 device-n
Additional resources
-
The
stratis(8)
man page
17.3. Monitoring Stratis file systems
As a Stratis user, you can view information about Stratis volumes on your system to monitor their state and free space.
17.3.1. Stratis sizes reported by different utilities
This section explains the difference between Stratis sizes reported by standard utilities such as df
and the stratis
utility.
Standard Linux utilities such as df
report the size of the XFS file system layer on Stratis, which is 1 TiB. This is not useful information, because the actual storage usage of Stratis is less due to thin provisioning, and also because Stratis automatically grows the file system when the XFS layer is close to full.
Regularly monitor the amount of data written to your Stratis file systems, which is reported as the Total Physical Used value. Make sure it does not exceed the Total Physical Size value.
Additional resources
-
The
stratis(8)
man page
17.3.2. Displaying information about Stratis volumes
This procedure lists statistics about your Stratis volumes, such as the total, used, and free size or file systems and block devices belonging to a pool.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running.
Procedure
To display information about all block devices used for Stratis on your system:
# stratis blockdev Pool Name Device Node Physical Size State Tier my-pool /dev/sdb 9.10 TiB In-use Data
To display information about all Stratis pools on your system:
# stratis pool Name Total Physical Size Total Physical Used my-pool 9.10 TiB 598 MiB
To display information about all Stratis file systems on your system:
# stratis filesystem Pool Name Name Used Created Device my-pool my-fs 546 MiB Nov 08 2018 08:03 /stratis/my-pool/my-fs
Additional resources
-
The
stratis(8)
man page
17.4. Using snapshots on Stratis file systems
You can use snapshots on Stratis file systems to capture file system state at arbitrary times and restore it in the future.
17.4.1. Characteristics of Stratis snapshots
This section describes the properties and limitations of file system snapshots on Stratis.
In Stratis, a snapshot is a regular Stratis file system created as a copy of another Stratis file system. The snapshot initially contains the same file content as the original file system, but can change as the snapshot is modified. Whatever changes you make to the snapshot will not be reflected in the original file system.
The current snapshot implementation in Stratis is characterized by the following:
- A snapshot of a file system is another file system.
- A snapshot and its origin are not linked in lifetime. A snapshotted file system can live longer than the file system it was created from.
- A file system does not have to be mounted to create a snapshot from it.
- Each snapshot uses around half a gigabyte of actual backing storage, which is needed for the XFS log.
17.4.2. Creating a Stratis snapshot
This procedure creates a Stratis file system as a snapshot of an existing Stratis file system.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis file system. See Section 17.1.6, “Creating a Stratis file system”.
Procedure
To create a Stratis snapshot, use:
# stratis fs snapshot my-pool my-fs my-fs-snapshot
Additional resources
-
The
stratis(8)
man page
17.4.3. Accessing the content of a Stratis snapshot
This procedure mounts a snapshot of a Stratis file system to make it accessible for read and write operations.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis snapshot. See Section 17.4.2, “Creating a Stratis snapshot”.
Procedure
To access the snapshot, mount it as a regular file system from the
/stratis/my-pool/
directory:# mount /stratis/my-pool/my-fs-snapshot mount-point
Additional resources
- Section 17.1.7, “Mounting a Stratis file system”
-
The
mount(8)
man page
17.4.4. Reverting a Stratis file system to a previous snapshot
This procedure reverts the content of a Stratis file system to the state captured in a Stratis snapshot.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis snapshot. See Section 17.4.2, “Creating a Stratis snapshot”.
Procedure
Optionally, back up the current state of the file system to be able to access it later:
# stratis filesystem snapshot my-pool my-fs my-fs-backup
Unmount and remove the original file system:
# umount /stratis/my-pool/my-fs # stratis filesystem destroy my-pool my-fs
Create a copy of the snapshot under the name of the original file system:
# stratis filesystem snapshot my-pool my-fs-snapshot my-fs
Mount the snapshot, which is now accessible with the same name as the original file system:
# mount /stratis/my-pool/my-fs mount-point
The content of the file system named my-fs is now identical to the snapshot my-fs-snapshot.
Additional resources
-
The
stratis(8)
man page
17.4.5. Removing a Stratis snapshot
This procedure removes a Stratis snapshot from a pool. Data on the snapshot are lost.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis snapshot. See Section 17.4.2, “Creating a Stratis snapshot”.
Procedure
Unmount the snapshot:
# umount /stratis/my-pool/my-fs-snapshot
Destroy the snapshot:
# stratis filesystem destroy my-pool my-fs-snapshot
Additional resources
-
The
stratis(8)
man page
17.5. Removing Stratis file systems
You can remove an existing Stratis file system or a Stratis pool, destroying data on them.
17.5.1. Components of a Stratis volume
Externally, Stratis presents the following volume components in the command-line interface and the API:
blockdev
- Block devices, such as a disk or a disk partition.
pool
Composed of one or more block devices.
A pool has a fixed total size, equal to the size of the block devices.
The pool contains most Stratis layers, such as the non-volatile data cache using the
dm-cache
target.Stratis creates a
/stratis/my-pool/
directory for each pool. This directory contains links to devices that represent Stratis file systems in the pool.
filesystem
Each pool can contain one or more file systems, which store files.
File systems are thinly provisioned and do not have a fixed total size. The actual size of a file system grows with the data stored on it. If the size of the data approaches the virtual size of the file system, Stratis grows the thin volume and the file system automatically.
The file systems are formatted with XFS.
ImportantStratis tracks information about file systems created using Stratis that XFS is not aware of, and changes made using XFS do not automatically create updates in Stratis. Users must not reformat or reconfigure XFS file systems that are managed by Stratis.
Stratis creates links to file systems at the
/stratis/my-pool/my-fs
path.
Stratis uses many Device Mapper devices, which show up in dmsetup
listings and the /proc/partitions
file. Similarly, the lsblk
command output reflects the internal workings and layers of Stratis.
17.5.2. Removing a Stratis file system
This procedure removes an existing Stratis file system. Data stored on it are lost.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis file system. See Section 17.1.6, “Creating a Stratis file system”.
Procedure
Unmount the file system:
# umount /stratis/my-pool/my-fs
Destroy the file system:
# stratis filesystem destroy my-pool my-fs
Verify that the file system no longer exists:
# stratis filesystem list my-pool
Additional resources
-
The
stratis(8)
man page
17.5.3. Removing a Stratis pool
This procedure removes an existing Stratis pool. Data stored on it are lost.
Prerequisites
- Stratis is installed. See Section 17.1.4, “Installing Stratis”.
-
The
stratisd
service is running. - You have created a Stratis pool. See Section 17.1.5, “Creating a Stratis pool”.
Procedure
List file systems on the pool:
# stratis filesystem list my-pool
Unmount all file systems on the pool:
# umount /stratis/my-pool/my-fs-1 \ /stratis/my-pool/my-fs-2 \ /stratis/my-pool/my-fs-n
Destroy the file systems:
# stratis filesystem destroy my-pool my-fs-1 my-fs-2
Destroy the pool:
# stratis pool destroy my-pool
Verify that the pool no longer exists:
# stratis pool list
Additional resources
-
The
stratis(8)
man page