How to install Stratis on CentOS 8 / RHEL 8?. Stratis is a local storage-management solution for Linux focused on simplicity and ease of use. It uses Linux’s devicemapper subsystem and the XFS filesystem. Stratis also gives you access to advanced storage features such as:
- Thin provisioning
- File system snapshots
- Pool-based management
- Monitoring.
As a system administrator, you can easily set up new storage and manage complex storage configurations integrated by the Stratis high-level system. It is a hybrid user-and-kernel local storage management system that uses the concept of a storage pool.
Stratis is the new local storage manager for RHEL 8. You can check other RHEL 8 new Features on Red Hat Enterprise Linux 8 (RHEL 8) New Features & Review
Stratis Terminologies
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 pools are located under the /dev/stratis/<poolname>
directory.
Stratis Supported devices
Stratis works with the following block devices:
- iSCSI
- LVM logical volumes
- Device Mapper Multipath
- hard drives
- LUKS
- SSDs
- NVMe storage devices
- mdraid
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
RHEL 8 is distributed withstratisd
and stratis-cli
which can be easily installed using yum
package management tool.
sudo yum -y install stratisd stratis-cli
You can get full package details using rpm command:
# rpm -qi stratisd stratis-cli
Name : stratisd
Version : 2.4.2
Release : 2.el8
Architecture: x86_64
Install Date: Mon 05 Jun 2023 10:57:36 PM UTC
Group : Unspecified
Size : 13527243
License : MPLv2.0
Signature : RSA/SHA256, Tue 09 Nov 2021 03:01:31 PM UTC, Key ID 15af5dac6d745a60
Source RPM : stratisd-2.4.2-2.el8.src.rpm
Build Date : Tue 09 Nov 2021 02:35:59 PM UTC
Build Host : ord1-prod-x86build004.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager : [email protected]
.....
Name : stratis-cli
Version : 2.4.2
Release : 1.el8
Architecture: noarch
Install Date: Mon 05 Jun 2023 10:57:36 PM UTC
Group : Unspecified
Size : 311001
License : ASL 2.0
Signature : RSA/SHA256, Tue 09 Nov 2021 03:00:53 PM UTC, Key ID 15af5dac6d745a60
Source RPM : stratis-cli-2.4.2-1.el8.src.rpm
Build Date : Tue 09 Nov 2021 02:29:36 PM UTC
Build Host : ord1-prod-x86build003.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager : [email protected]
Step 2: Start Stratis service
After installing Stratis packages, you’ll need to start the service and enable it.
systemctl enable --now stratisd
Confirm service status:
$ systemctl status stratisd
● stratisd.service - Stratis daemon
Loaded: loaded (/usr/lib/systemd/system/stratisd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2023-06-05 22:58:27 UTC; 11s ago
Docs: man:stratisd(8)
Main PID: 71943 (stratisd)
Tasks: 6 (limit: 23036)
Memory: 1.6M
CGroup: /system.slice/stratisd.service
└─71943 /usr/libexec/stratisd --log-level debug
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z INFO libstratis::stratis::run] stratis daemon version 2.4.2 started
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z INFO libstratis::stratis::run] Using StratEngine
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z INFO libstratis::engine::strat_engine::liminal::identify] Beginning initial search for Stratis block devices
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z DEBUG libstratis::stratis::run] 0: thread started
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z DEBUG libstratis::stratis::run] 1: thread started
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z DEBUG libstratis::stratis::run] 2: thread started
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z DEBUG libstratis::stratis::run] 3: thread started
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z INFO libstratis::stratis::ipc_support::dbus_support] D-Bus API is available
Jun 05 22:58:27 rocky8.mylab.io stratisd[71943]: [2023-06-05T22:58:27Z DEBUG libstratis::stratis::run] 4: thread started
Jun 05 22:58:27 rocky8.mylab.io systemd[1]: Started Stratis daemon.
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.
On my RHEL 8 server, I have the following block devices:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 20G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 19G 0 part
├─rhel-root 253:0 0 17G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
vdb 252:16 0 10G 0 disk
vdc 252:32 0 10G 0 disk
vdd 252:48 0 10G 0 disk
vde 252:64 0 10G 0 disk
I’ll create the first pool with single block device /dev/vdb
and the other pool with three block devices /dev/vdc,/dev/vdd,/dev/vdd
These block devices should not have a partition table, confirm with:
sudo blkid -p /<devicepath>
If it has a partition table and you want to use it, first clear a device so that it can be used by Stratis.
sudo wipefs -a /<devicepath>
Create a pool with one block device
To create a pool with one block device /dev/vdb
use:
sudo stratis pool create mypool1 /dev/vdb
List available pools with:
$ sudo stratis pool list
Name Total Physical Size Total Physical Used
mypool1 10 GiB 52 MiB
Create a pool with three block device
Now let’s create another pool with three block devices /dev/vdc,/dev/vdd,/dev/vdd
sudo stratis pool create mypool2 /dev/vdc /dev/vdd /dev/vde
You should now have two pools:
$ sudo stratis pool list
Name Total Physical Size Total Physical Used
mypool1 10 GiB 52 MiB
mypool2 30 GiB 60 MiB
From the output, we can see that the size of the volume is the summation of all block devices raw storage.
Step 4: Creating a filesystem from the pool
Once you have your pools ready, you can create a Stratis file system on a pool using the syntax:
sudo stratis fs create <poolname> <filesystemname>
See examples below.
Create a filesystem on mypool1
sudo stratis fs create mypool1 logs
Create a filesystem on mypool2
sudo stratis fs create mypool2 data
sudo stratis fs create mypool2 web
To list created filesystems, use:
$ sudo stratis fs list
Pool Name Name Used Created Device
mypool1 logs 546 MiB Dec 11 2018 01:00 /dev/stratis/mypool1/logs
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
You can also limit output to specified pool:
$ sudo stratis fs list mypool2
Pool Name Name Used Created Device
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
mypool2 web 546 MiB Dec 11 2018 01:06 /dev/stratis/mypool2/web
The lsblk
output should look similar to below:
$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 20G 0 disk
├─vda1 252:1 0 1G 0 part /boot
└─vda2 252:2 0 19G 0 part
├─rhel-root 253:0 0 17G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
vdb 252:16 0 10G 0 disk
└─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-physical-originsub 253:2 0 1.8G 0 stratis
├─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-flex-thinmeta 253:3 0 16M 0 stratis
│ └─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-thinpool-pool 253:6 0 1.8G 0 stratis
│ ├─stratis-1-68bf465c93eb4aa98ed2264b38d8c42a-thin-fs-217bee04c2f14266b496eaada54a0311 253:12 0 1T 0 stratis
│ └─stratis-1-68bf465c93eb4aa98ed2264b38d8c42a-thin-fs-1f563ecb6e0c497ab3fc24d5b2e33fe1 253:13 0 1T 0 stratis
├─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-flex-thindata 253:4 0 1.8G 0 stratis
│ └─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-thinpool-pool 253:6 0 1.8G 0 stratis
│ ├─stratis-1-68bf465c93eb4aa98ed2264b38d8c42a-thin-fs-217bee04c2f14266b496eaada54a0311 253:12 0 1T 0 stratis
│ └─stratis-1-68bf465c93eb4aa98ed2264b38d8c42a-thin-fs-1f563ecb6e0c497ab3fc24d5b2e33fe1 253:13 0 1T 0 stratis
└─stratis-1-private-68bf465c93eb4aa98ed2264b38d8c42a-flex-mdv 253:5 0 16M 0 stratis
vdc 252:32 0 10G 0 disk
vdd 252:48 0 10G 0 disk
vde 252:64 0 10G 0 disk
└─stratis-1-private-557de29f274a45d583c62cafbab8edd6-physical-originsub 253:7 0 816M 0 stratis
├─stratis-1-private-557de29f274a45d583c62cafbab8edd6-flex-thinmeta 253:8 0 16M 0 stratis
│ └─stratis-1-private-557de29f274a45d583c62cafbab8edd6-thinpool-pool 253:11 0 768M 0 stratis
├─stratis-1-private-557de29f274a45d583c62cafbab8edd6-flex-thindata 253:9 0 768M 0 stratis
│ └─stratis-1-private-557de29f274a45d583c62cafbab8edd6-thinpool-pool 253:11 0 768M 0 stratis
└─stratis-1-private-557de29f274a45d583c62cafbab8edd6-flex-mdv 253:10 0 16M 0 stratis
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:
sudo mkdir /data
sudo mount /dev/stratis/mypool2/data /data
I’ll also mount /dev/stratis/mypool2/web
sudo mount /dev/stratis/mypool2/web /srv
Check currents mount points:
$ sudo df -hT | grep stratis
The output is:
Add a persistent mount point to /etc/fstab
To configure persistent mount, get the UUID of the filesystem.
# blkid -p /dev/stratis/mypool2/web
/dev/stratis/mypool2/web: UUID="7d3b49be-51d5-499c-b12b-b5ebe118c416" TYPE="xfs" USAGE="filesystem"
# blkid -p /dev/stratis/mypool2/data
/dev/stratis/mypool2/data: UUID="a6f40f25-140c-43e3-97af-e9e771f08a54" TYPE="xfs" USAGE="filesystem"
Copy the printed UUID and add mount options to /etc/fstab
file
echo "UUID=7d3b49be-51d5-499c-b12b-b5ebe118c416 /srv xfs defaults 0 0" | sudo tee -a /etc/fstab
echo "UUID=a6f40f25-140c-43e3-97af-e9e771f08a54 /data xfs defaults 0 0" | sudo tee -a /etc/fstab
Test:
sudo umount /data
sudo umount /srv
sudo mount -a
Other Stratis Administration Commands
Below are other administrative tasks you can perform on Stratis Pools.
Removing a Stratis file system
Before you can remove Stratis file system, you need to unmount it
sudo umount /mountpoint
Then destroy it:
sudo stratis filesystem destroy <poolname< <filesystemname>
Example
sudo umount /srv
sudo stratis filesystem destroy mypool2 web
Confirm:
$ sudo stratis filesystem list mypool2
Pool Name Name Used Created Device
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
Add a disk to an existing pool
To add another disk to the pool, use:
sudo stratis pool add-data <poolname> /<devicepath>
Example:
sudo stratis pool add-data mypool1 /dev/vdf
Confirm:
$ sudo stratis pool list
Name Total Physical Size Total Physical Used
mypool1 20 GiB 1.12 GiB
mypool2 30 GiB 606 MiB
Create Stratis snapshots
Stratis Snapshot is a read/writeable
thinly provisioned point in time copy of the source FS.
To create Stratis snapshot, use:
sudo stratis fs snapshot <poolname> <fsname> <snapshotname>
Example:
sudo stratis fs snapshot mypool2 web websnapshot-$(date +%Y-%m-%d)
Confirm:
$ sudo stratis filesystem list mypool2
Pool Name Name Used Created Device
mypool2 web 546 MiB Dec 11 2018 01:06 /dev/stratis/mypool2/web
mypool2 websnapshot-2018-12-11 546 MiB Dec 11 2018 03:34 /dev/stratis/mypool2/websnapshot-2018-12-11
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
You can mount and operate Snapshot independent of the source file system.
sudo mount /dev/stratis/mypool2/websnapshot-2018-12-11 /mnt
for i in {1..10}; do sudo touch /mnt/$i.txt; done
ls /mnt
ls /srv
sudo umount /mnt
Revert a Stratis file system to a previous snapshot
It is possible to revert a Statis file system to the previously created snapshot. See below
First Unmount and remove the original file system:
sudo umount /srv
sudo stratis filesystem destroy mypool2 web
Then create a copy of the snapshot under the name of the original file system:
sudo stratis filesystem snapshot mypool2 websnapshot-2018-12-11 web
Mount the snapshot
sudo mount /dev/stratis/mypool2/web /srv
This filesystem should contain the data we added to the snapshot
$ ls /srv/
10.txt 1.txt 3.txt 5.txt 7.txt 9.txt
1..10.txt 2.txt 4.txt 6.txt 8.txt
Also change UUID on /etc/fstab
to match new filesystem UUID.
# blkid -p /dev/stratis/mypool2/web
/dev/stratis/mypool2/web: UUID="110b737f-2117-4624-8c97-c3def8b2a539" TYPE="xfs" USAGE="filesystem"
# grep srv /etc/fstab
UUID=110b737f-2117-4624-8c97-c3def8b2a539 /srv xfs defaults 0 0
Removing a Stratis snapshot
To remove the snapshot, unmount the snapshot.
sudo unmount /snapmountpoint
Now destroy the snapshot:
sudo stratis filesystem destroy <poolname> <snapshotname>
Example:
sudo stratis filesystem destroy mypool2 websnapshot-2018-12-11
Check:
$ sudo stratis filesystem list mypool2
Pool Name Name Used Created Device
mypool2 web 546 MiB Dec 11 2018 03:58 /dev/stratis/mypool2/web
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
Renaming a file system
To rename a file system, use the syntax:
sudo stratis filesystem rename <poolname> <old-fsname> <new-fsname>
The example below renames logs filesystem to backups
sudo stratis filesystem rename mypool1 logs backups
Confirm:
$ sudo stratis filesystem list mypool1
Pool Name Name Used Created Device
mypool1 backups 546 MiB Dec 11 2018 01:00 /dev/stratis/mypool1/backups
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 mypool2
1.
List available file systems
$ sudo stratis filesystem list mypool2
Pool Name Name Used Created Device
mypool2 data 546 MiB Dec 11 2018 01:04 /dev/stratis/mypool2/data
2.
Unmount the file systems
sudo umount /dev/stratis/mypool2/data
3.
Destroy file system:
sudo stratis filesystem destroy mypool2 data
4.
Destroy the pool
sudo stratis pool destroy mypool2
4.
Verify that the pool no longer exists:
$ sudo stratis pool list
Name Total Physical Size Total Physical Used
mypool1 20 GiB 1.12 GiB
6.
Remove /etc/fstab
lines for destroyed file system
sudo vim /etc/fstab
You have learned how to install and use Stratis to manage layered local storage on RHEL 8 and Fedora Linux distributions. My next articles will cover the installation and usage of Stratis on CentOS 7, Debian and Ubuntu.
Similar guides:
Install and Configure NFS Server on RHEL 8 / CentOS 8