Install and Use Stratis to Manage Local Storage on RHEL8/CentOS8
Stratis is a user-space daemon that configures and monitors existing components from Linux’s device-mapper subsystem, as well as the XFS filesystem. Stratis Pool which is the central attraction of the Stratis tool is a collection of one or more local disks or partitions. Once the pool is created, administrators can create volumes.
Currently, Stratis supports block devices based on LVM Logical Volumes, mdraid, dm-multipath, iSCSI, and LUKS (crypto), as well as hard drives, SSDs, and NVMe storage devices.
|Stratis of Elements|
Internally, Stratis uses the Backstore subsystem to manage the block devices, and the Thinpool subsystem to manage the pools. The Backstore subsystem has a data tier that maintains the on-disk metadata on block devices and detects and corrects data corruption. The cache tier uses high-performance block devices to act as a cache on top of the data tier. The Thinpool subsystem manages the thin-provisioned volumes associated with the Stratis filesystems. This subsystem uses the dm-thin device-mapper driver to replace LVM on the virtual volume sizing and management. dm-thin creates volumes with a large virtual size, formatted with XFS, but with a small physical size. As the physical size nears full, Stratis enlarges it automatically.
- Thin provisioning
- File system snapshots
- Pool-based management
When working with Stratis, you’ll often come across the following terminologies:
- blockdev: This is a block device, such as a disk or a disk partition.
- pool: A pool is composed of one or more block devices with a fixed total size, equal to the size of the block devices.
- filesystem: Each pool can contain one or more file systems, which store files. A filesystem does not have a fixed total size since it is thinly provisioned. If the size of the data approaches the virtual size of the file system, Stratis grows the thin volume and the file system automatically.
Stratis Software components
Stratis provides two software components:
- stratisd daemon: This manages collections of block devices and provides a D-Bus API.
- stratis-cli: This provides a command-line tool stratis which itself uses the D-Bus API to communicate with stratisd.
Step 1: Install Stratis on RHEL 8 / CentOS 8
You can get full package details using the rpm command:
Step 2: Start Stratis service
After installing Stratis packages, you’ll need to start the service and enable it.
Step 3: Creating a Stratis pool
For this, you’ll require block devices which are not in use or mounted to create Stratis pool from. The block devices should be at least 1 GiB in size each.
I’ll create the first pool with single block device nvme0n2 and the other pool with two block devices nvme0n3 & nvme0n4
These block devices should not have a partition table, confirm with:
If it has a partition table and you want to use it, first clear a device so that it can be used by Stratis.
Create a pool with one block device
To create a pool with one block device /dev/nvme0n2 use:
List available pools with:
Create a pool with two block device
Now let’s create another pool with two block devices /dev/nvme0n3,/dev/nvme0n4
You should now have two pools:
Step 4: Creating a filesystem from the pool
Once you have your pools ready, you can create a Stratis filesystem on a pool using the syntax:
Create a filesystem on mypool1
Create filesystem on mypool2
To list created filesystems, use:
You can also limit output to specified pool:
Step 5: Mounting a Stratis file system
To mount the file system, use the entries that Stratis maintains in the /dev/stratis/ directory. See examples below:
Create directories, /myfs. /data & /web
Check current mount points.
Add a persistent mount point to /etc/fstab
To configure persistent mount, get the UUID of the filesystem.
Copy the printed UUID and add mount options to /etc/fstab file
Stratis Administration Tasks & Commands
- Add a disk to an existing pool
- Create Stratis snapshots
- Revert a Stratis file system to a previous snapshot
- Removing a Stratis snapshot
- Renaming a file system
- Removing a Stratis pool
Add a disk to an existing pool
Create Stratis snapshots
Revert a Stratis file system to a previous snapshot
Removing a Stratis snapshot
Renaming a file system
Removing a Stratis pool
To completely destroy a Stratis pool, you need to:
- Unmount all file systems on the pool
- Destroy the file systems:
- Destroy the pool
In below example, we will destroy mypool1
1. List available file systems
We are sure, you must have liked this tutorial and if you really do, please share it with your friends and colleagues. Also, do subscribe to our blog and follow us on all the social media channels for more updates