CentOS

How to configure Stratis Filesystem on CentOS 8

Share on Social Media

In this article, you will learn how to configure Stratis Filesystem on CentOS 8 or Redhat based Linux distros. #centlinux #linux #filesystem

What is Stratis Filesystem?

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.

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.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

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 Linux 8.0
  • Hostname – stratis-01.centlinux.com
  • IP Address – 192.168.116.206 /24

Install Stratis Filesystem on CentOS 8

Connect with stratis-01.centlinux.com using ssh as root user.

To setup Stratis Filesystem 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.

# dnf install -y stratisd stratis-cli

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

# systemctl start stratisd.service

Stratis has been successfully installed on CentOS 8.

Create 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.

# 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.

# 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.

# stratis pool create db_pool /dev/sdb

Check current storage pools again.

# 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.

# stratis pool add-data db_pool /dev/sdc

Check current storage pools list.

# 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.

# stratis pool create backup_pool /dev/sdd /dev/sde

Check current storage pools now.

# stratis pool list
Name       Total Physical Size  Total Physical Used
backup_pool             20 GiB               56 MiB
db_pool                 20 GiB               56 MiB

Create Stratis FileSystems

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

# stratis fs create db_pool prod_db_fs
# stratis fs create db_pool test_db_fs

Check the list of Stratis filesystems.

# 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 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.

# 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.

# mkdir /mnt/{prod,test}

Edit /etc/fstab to add automount entries.

# 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.

# systemctl daemon-reload

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

# mount -a

Verify that our Stratis filesystem are mounted correctly.

# 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)

Create Snapshot of Stratis FileSystems

Copy some data in /mnt/prod directory.

# cp -r /etc/[a-f]* /mnt/prod

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

# stratis fs snapshot db_pool prod_db_fs prod_db_bkp_17dev2019

Check Stratis filesystems.

# 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.

Remove a Stratis FileSystem

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

# umount /mnt/test
# stratis fs destroy db_pool test_db_pool

Remove 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.

# stratis pool destroy backup_pool

If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.

Conclusion

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.

If you need any help in your Linux Server configurations then Feel free to contact me on Fiverr: Linux Admin Expert

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

Share
Published by
Alaric Bird

Recent Posts

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

3 weeks ago

VPS Server: The Ultimate Guide to Virtual Private Servers

Explore the ultimate guide to VPS servers and learn everything about Virtual Private Servers, including…

4 weeks ago

This website uses cookies.