Configure Stratis Local Storage on CentOS 8 - CentLinux - Installation Guides & HowTos


Wednesday, 18 December 2019

Configure Stratis Local Storage on CentOS 8

Configure Stratis Local Storage on CentOS 8

Stratis is a Linux local storage management tool that aims to enable easy use of advanced storage features such as thin provisioning, snapshots, and pool-based management & monitoring.

Stratis daemon is originally developed by Red Hat. Stratis is written in RUST language and distributed under Mozilla Public License 2.0. Stratis provides ZFS/Btrfs-style features by integrating layers of existing technology: Linux's device mapper subsystem, and the XFS filesystem.

In this article, we will install and configure Stratis local storage on CentOS 8.


Table of Contents:


Stratis Storage Features:

Stratis storage provides following advanced features.

  • Thin Provisioning
  • Pool Based Management and Monitoring
  • FileSystem Snapshots


Stratis Storage Building Blocks:

To understand Stratis Storage architecture, you need know the following three buidling blocks.

  • Block Device: A block device can be a disk, partition or Logical Volume (LVM).
  • Storage Pool: A Stratis storage pool consist of one or more Block devices.
  • FileSystem: A FileSystem is a final ready to mount storage. It is provisioned from a Storage Pool.


Environment Specification:

We have provisioned virtual machine with minimally installed CentOS 8 with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 1 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.0
  • Hostname -
  • IP Address - /24


Installing Stratis Local Storage on CentOS 8:

Connect with using ssh as root user.

To setup Stratis Local Storage on CentOS 8, we have to install following two packages.

  • stratisd - Stratis Daemon
  • stratis-cli - Command-line interface to manage stratis local storage.

Both packages are available in default dnf repository, therefore, we are installing it using dnf command.

[root@stratis-01 ~]# dnf install -y stratisd stratis-cli Last metadata expiration check: 0:00:59 ago on Mon 16 Dec 2019 07:43:33 PM PKT. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: stratis-cli noarch 1.0.2-1.el8 AppStream 51 k stratisd x86_64 1.0.3-1.el8 AppStream 1.2 M Installing dependencies: python3-dbus-client-gen noarch 0.4-1.el8 AppStream 26 k python3-dbus-python-client-gen noarch 0.6-2.el8 AppStream 24 k python3-dbus-signature-pyparsing noarch 0.03-2.el8 AppStream 18 k python3-into-dbus-python noarch 0.06-2.el8 AppStream 27 k python3-justbases noarch 0.9-6.el8 AppStream 45 k python3-justbytes noarch 0.11-2.el8 AppStream 40 k python3-pyparsing noarch 2.1.10-7.el8 BaseOS 142 k Transaction Summary ================================================================================ Install 9 Packages Total download size: 1.6 M Installed size: 5.1 M Downloading Packages: (1/9): python3-dbus-client-gen-0.4-1.el8.noarch 13 kB/s | 26 kB 00:01 (2/9): python3-dbus-signature-pyparsing-0.03-2. 9.3 kB/s | 18 kB 00:01 (3/9): python3-dbus-python-client-gen-0.6-2.el8 12 kB/s | 24 kB 00:02 (4/9): python3-into-dbus-python-0.06-2.el8.noar 68 kB/s | 27 kB 00:00 (5/9): python3-justbases-0.9-6.el8.noarch.rpm 59 kB/s | 45 kB 00:00 (6/9): python3-justbytes-0.11-2.el8.noarch.rpm 55 kB/s | 40 kB 00:00 (7/9): stratis-cli-1.0.2-1.el8.noarch.rpm 56 kB/s | 51 kB 00:00 (8/9): python3-pyparsing-2.1.10-7.el8.noarch.rp 64 kB/s | 142 kB 00:02 (9/9): stratisd-1.0.3-1.el8.x86_64.rpm 162 kB/s | 1.2 MB 00:07 -------------------------------------------------------------------------------- Total 121 kB/s | 1.6 MB 00:13 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-pyparsing-2.1.10-7.el8.noarch 1/9 Installing : python3-dbus-signature-pyparsing-0.03-2.el8.noarch 2/9 Installing : python3-into-dbus-python-0.06-2.el8.noarch 3/9 Installing : python3-dbus-python-client-gen-0.6-2.el8.noarch 4/9 Installing : stratisd-1.0.3-1.el8.x86_64 5/9 Running scriptlet: stratisd-1.0.3-1.el8.x86_64 5/9 Installing : python3-justbases-0.9-6.el8.noarch 6/9 Installing : python3-justbytes-0.11-2.el8.noarch 7/9 Installing : python3-dbus-client-gen-0.4-1.el8.noarch 8/9 Installing : stratis-cli-1.0.2-1.el8.noarch 9/9 Running scriptlet: stratis-cli-1.0.2-1.el8.noarch 9/9 Verifying : python3-dbus-client-gen-0.4-1.el8.noarch 1/9 Verifying : python3-dbus-python-client-gen-0.6-2.el8.noarch 2/9 Verifying : python3-dbus-signature-pyparsing-0.03-2.el8.noarch 3/9 Verifying : python3-into-dbus-python-0.06-2.el8.noarch 4/9 Verifying : python3-justbases-0.9-6.el8.noarch 5/9 Verifying : python3-justbytes-0.11-2.el8.noarch 6/9 Verifying : stratis-cli-1.0.2-1.el8.noarch 7/9 Verifying : stratisd-1.0.3-1.el8.x86_64 8/9 Verifying : python3-pyparsing-2.1.10-7.el8.noarch 9/9 Installed: stratis-cli-1.0.2-1.el8.noarch stratisd-1.0.3-1.el8.x86_64 python3-dbus-client-gen-0.4-1.el8.noarch python3-dbus-python-client-gen-0.6-2.el8.noarch python3-dbus-signature-pyparsing-0.03-2.el8.noarch python3-into-dbus-python-0.06-2.el8.noarch python3-justbases-0.9-6.el8.noarch python3-justbytes-0.11-2.el8.noarch python3-pyparsing-2.1.10-7.el8.noarch Complete!

Installer automatically enables the stratisd service. We are only required to start stratisd service once.

[root@stratis-01 ~]# systemctl start stratisd.service

Stratis has been successfully installed on CentOS 8.


Creating Stratis Storage Pools:

We have added four hard disks (10GB each) in our CentOS 8 virtual machine. We will use these disks as block devices for our Stratis storage pools.

[root@stratis-01 ~]# lsblk | grep 'sd[b-e]' sdb 8:16 0 10G 0 disk sdc 8:32 0 10G 0 disk sdd 8:48 0 10G 0 disk sde 8:64 0 10G 0 disk

Check current storage pools.

[root@stratis-01 ~]# stratis pool list Name Total Physical Size Total Physical Used

Right now, we have no storage pool defined.

Let's create a Stratis storage pool using /dev/sdb block device.

[root@stratis-01 ~]# stratis pool create db_pool /dev/sdb

Check current storage pools again.

[root@stratis-01 ~]# stratis pool list Name Total Physical Size Total Physical Used db_pool 10 GiB 52 MiB


Add a Block Device to Existing Stratis Storage Pool:

Let's add our second disk to the db_pool stratis storage pool.

[root@stratis-01 ~]# stratis pool add-data db_pool /dev/sdc

Check current storage pools list.

[root@stratis-01 ~]# stratis pool list Name Total Physical Size Total Physical Used db_pool 20 GiB 56 MiB

You can see that the total size of the db_pool has been increased.


Create Stratis Storage Pool from Multiple Block Devices:

We can alternatively, create a pool using multiple block devices in a single command.

[root@stratis-01 ~]# stratis pool create backup_pool /dev/sdd /dev/sde

Check current storage pools now.

[root@stratis-01 ~]# stratis pool list Name Total Physical Size Total Physical Used backup_pool 20 GiB 56 MiB db_pool 20 GiB 56 MiB


Creating Stratis FileSystems:

We have a Stratis storage pool, we can now use it to provision Stratis filesystems as follows.

[root@stratis-01 ~]# stratis fs create db_pool prod_db_fs [root@stratis-01 ~]# stratis fs create db_pool test_db_fs

Check the list of Stratis filesystems.

[root@stratis-01 ~]# stratis fs list Pool Name Name Used Created Device UUID db_pool prod_db_fs 546 MiB Dec 17 2019 22:22 /stratis/db_pool/prod_db_fs d62f6884dffc40a6b8024784b7f60ca8 db_pool test_db_fs 546 MiB Dec 17 2019 22:22 /stratis/db_pool/test_db_fs 9ce32861f56b408597550d88e9bf5a44


Mounting the Stratis FileSystems:

We have create two Stratis filesystems, one for our Production database (prod_db_fs) and the other for the Test database (test_db_fs).

Now it's time to mount these filesystems.

To mount these filesystems, we need to identify the UUID of the filesystems. We can obtain the UUID using following command.

[root@stratis-01 ~]# blkid | grep /dev/mapper/stratis /dev/mapper/stratis-1-c943c04939f5432cbe4d3d9985cd462e-thin-fs-d62f6884dffc40a6b8024784b7f60ca8: UUID="d62f6884-dffc-40a6-b802-4784b7f60ca8" TYPE="xfs" /dev/mapper/stratis-1-c943c04939f5432cbe4d3d9985cd462e-thin-fs-9ce32861f56b408597550d88e9bf5a44: UUID="9ce32861-f56b-4085-9755-0d88e9bf5a44" TYPE="xfs"

We can use these UUIDs to persistently mount our Stratis filesystems.

Create directories to mount Stratis filesystems.

[root@stratis-01 ~]# mkdir /mnt/{prod,test}

Edit /etc/fstab to add automount entries.

[root@stratis-01 ~]# vi /etc/fstab

Add entries for our Stratis filesystems therein.

UUID=d62f6884-dffc-40a6-b802-4784b7f60ca8 /mnt/prod xfs defaults,x-systemd.requires=stratisd.service 0 0 UUID=9ce32861-f56b-4085-9755-0d88e9bf5a44 /mnt/test xfs defaults,x-systemd.requires=stratisd.service 0 0

Execute following command to update systemd units generated from this file.

[root@stratis-01 ~]# systemctl daemon-reload

Mount all entries in /etc/fstab using mount command.

[root@stratis-01 ~]# mount -a

Verify that our Stratis filesystem are mounted correctly.

[root@stratis-01 ~]# mount | grep /dev/mapper/stratis /dev/mapper/stratis-1-c943c04939f5432cbe4d3d9985cd462e-thin-fs-d62f6884dffc40a6b8024784b7f60ca8 on /mnt/prod type xfs (rw,relatime,seclabel,attr2,inode64,sunit=2048,swidth=2048,noquota,x-systemd.requires=stratisd.service) /dev/mapper/stratis-1-c943c04939f5432cbe4d3d9985cd462e-thin-fs-9ce32861f56b408597550d88e9bf5a44 on /mnt/test type xfs (rw,relatime,seclabel,attr2,inode64,sunit=2048,swidth=2048,noquota,x-systemd.requires=stratisd.service)


Creating Snapshot of Stratis FileSystems:

Copy some data in /mnt/prod directory.

[root@stratis-01 ~]# cp -r /etc/[a-f]* /mnt/prod

We can take snapshot of the prod_db_fs filesystem using following command.

[root@stratis-01 ~]# stratis fs snapshot db_pool prod_db_fs prod_db_bkp_17dev2019

Check Stratis filesystems.

[root@stratis-01 ~]# stratis fs list Pool Name Name Used Created Device UUID db_pool prod_db_bkp_17dev2019 577 MiB Dec 17 2019 23:28 /stratis/db_pool/prod_db_bkp_17dev2019 b4583769df9e40d790a55f11b705b65d db_pool prod_db_fs 577 MiB Dec 17 2019 22:22 /stratis/db_pool/prod_db_fs d62f6884dffc40a6b8024784b7f60ca8 db_pool test_db_fs 546 MiB Dec 17 2019 22:22 /stratis/db_pool/test_db_fs 9ce32861f56b408597550d88e9bf5a44

A Stratis Snapshot is also a Stratis filesystem, therefore, we can mount it inplace of the actual filesystem to restore a previous state of data, without required to remove the existing filesystem.


Removing a Stratis FileSystem:

To remove a filesystem, make sure it is not mounted and then remove it using following command.

[root@stratis-01 ~]# umount /mnt/test [root@stratis-01 ~]# stratis fs destroy db_pool test_db_pool


Removing a Stratis Storage Pool:

To remove a Stratis Storage, make sure that, there isn't any filesystem exists within that pool.

Remove an existing storage pool using following command.

[root@stratis-01 ~]# stratis pool destroy backup_pool



We have successfully installed and configured Stratis local storage on CentOS 8 and explored some of it's advanced features like thin-provisioning and snapshots.

No comments:

Post a Comment