Create Stratis File System (thin provision) with examples (CentOS/RHEL 8)


Written by - Deepak Prasad

This is going to be a two part article where in the first part I will give you an overview to install and configure stratis on RHEL 8 Linux host which includes installing pre-requisite rpms and starting required daemon services, creating pools, thin provisioned file systems and mounting these file systems to access and store our data. In the next article I will share the steps to create, modify and remove snapshot for a stratis file system/pool along with other stratis related commands using RHEL 8 Linux.

Create Stratis File System (thin provisioned) with examples (CentOS/RHEL 8)

 

Understanding Stratis

Stratis is a called Volume Managing file system, and it is Red Hat's answer to Btrfs and ZFS. Volume managing file system means that it works with the notion of volumes as well. So it's a layer in between the regular file system and the storage devices. And on top of Stratis a regular file system is needed.

NOTE:
Currently as the time of writing this article, only regular file system supported right now is XFS.

Stratis is built on top of any block device, and that includes LVM devices, which is interesting because Stratis is working with the notion of volumes and you know that the LVM is working with the notion of volumes as well. So you can configure Stratis in a way that on your server you will have volumes at two different levels.
The pool enables many useful advanced features, such as:

  • File system snapshots
  • Thin provisioning
  • Cache Tier - It works with cache tier, which means that it is handling caching in a very efficient way.
  • Programmatic API - which means that applications can directly address the Stratis process to configure storage.

 

Stratis Architecture

  • On the top in the Stratis architecture, there's pool. A pool is created from one or more storage devices, which are known as blockdev, Now blockdev are basically block devices, such as a disk or a disk partition.
  • Stratis will create a /dev/stratis/my-pool directory for each pool and this directory contains links to the devices that represent the file systems in the pool. Here pool is composed of one or more block devices.
  • A pool has a fixed total size, equal to the size of the block devices. Block devices in a pool may not be thin provisioned.
  • Thin provisioning is happening at the file system level.
  • The XFS file system is put in a volume on top of the pool and it's an integrated part of it. So file system and volume are a bundle, they come together.
  • Each pool can contain one or more file systems.
  • And file systems are thin provisioned, and they do not have a fixed size.
  • Every file system can just grow to the size of the pool.
  • The thin provisioned volume, which is an integrated part of the file system, automatically grows as more data is added to the file system

 

Installing on RHEL 8 Linux

This procedure installs all packages necessary to use Stratis using RHEL 8 vanilla DVD I used for installation of the operating system. I will be using RHEL 8 Linux node to demonstrate the steps in this article.

NOTE:
To be able to use yum command to install pre-requisite rpms, you must have a repository in place. You can either register your Red Hat node using subscription-manager or you can create an offline repo using the vanilla RHEL 8 DVD ISO .
[root@node4 dvd]# yum install stratis-cli stratisd
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:44 ago on Mon 17 Jun 2019 11:55:57 AM IST.
Dependencies resolved.
===================================================================================================================================================================
 Package                                               Arch                        Version                           Repository                               Size
===================================================================================================================================================================
Installing:
 stratis-cli                                           noarch                      1.0.0-2.el8                       rhel_dvd_appstream                       50 k
 stratisd                                              x86_64                      1.0.0-2.el8                       rhel_dvd_appstream                      1.2 M
Installing dependencies:
 python3-dbus-client-gen                               noarch                      0.3-1.el8                         rhel_dvd_appstream                       25 k
 python3-dbus-python-client-gen                        noarch                      0.6-2.el8                         rhel_dvd_appstream                       24 k
 python3-dbus-signature-pyparsing                      noarch                      0.03-2.el8                        rhel_dvd_appstream                       19 k
 python3-into-dbus-python                              noarch                      0.06-2.el8                        rhel_dvd_appstream                       27 k
 python3-justbases                                     noarch                      0.9-6.el8                         rhel_dvd_appstream                       45 k
 python3-justbytes                                     noarch                      0.11-2.el8                        rhel_dvd_appstream                       40 k
 python3-pyparsing                                     noarch                      2.1.10-7.el8                      rhel_dvd_baseos                         142 k

Transaction Summary
===================================================================================================================================================================
Install  9 Packages

Total size: 1.5 M
Installed size: 5.0 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                           1/1
Installed: python3-pyparsing-2.1.10-7.el8.noarch
  Installing       : python3-pyparsing-2.1.10-7.el8.noarch                                                                                                     1/9
Installed: python3-pyparsing-2.1.10-7.el8.noarch
Installed: python3-dbus-signature-pyparsing-0.03-2.el8.noarch
  Installing       : python3-dbus-signature-pyparsing-0.03-2.el8.noarch                                                                                        2/9
Installed: python3-dbus-signature-pyparsing-0.03-2.el8.noarch
Installed: python3-into-dbus-python-0.06-2.el8.noarch
  Installing       : python3-into-dbus-python-0.06-2.el8.noarch                                                                                                3/9
Installed: python3-into-dbus-python-0.06-2.el8.noarch
Installed: python3-dbus-python-client-gen-0.6-2.el8.noarch
  Installing       : python3-dbus-python-client-gen-0.6-2.el8.noarch                                                                                           4/9
Installed: python3-dbus-python-client-gen-0.6-2.el8.noarch
Installed: stratisd-1.0.0-2.el8.x86_64
  Installing       : stratisd-1.0.0-2.el8.x86_64                                                                                                               5/9
  Running scriptlet: stratisd-1.0.0-2.el8.x86_64                                                                                                               5/9
Installed: stratisd-1.0.0-2.el8.x86_64
Installed: python3-justbases-0.9-6.el8.noarch
  Installing       : python3-justbases-0.9-6.el8.noarch                                                                                                        6/9
Installed: python3-justbases-0.9-6.el8.noarch
Installed: python3-justbytes-0.11-2.el8.noarch
  Installing       : python3-justbytes-0.11-2.el8.noarch                                                                                                       7/9
Installed: python3-justbytes-0.11-2.el8.noarch
Installed: python3-dbus-client-gen-0.3-1.el8.noarch
  Installing       : python3-dbus-client-gen-0.3-1.el8.noarch                                                                                                  8/9
Installed: python3-dbus-client-gen-0.3-1.el8.noarch
Installed: stratis-cli-1.0.0-2.el8.noarch
  Installing       : stratis-cli-1.0.0-2.el8.noarch                                                                                                            9/9
Installed: stratis-cli-1.0.0-2.el8.noarch
  Running scriptlet: stratis-cli-1.0.0-2.el8.noarch                                                                                                            9/9
  Verifying        : python3-dbus-client-gen-0.3-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.0-2.el8.noarch                                                                                                            7/9
  Verifying        : stratisd-1.0.0-2.el8.x86_64                                                                                                               8/9
  Verifying        : python3-pyparsing-2.1.10-7.el8.noarch                                                                                                     9/9

Installed:
  stratis-cli-1.0.0-2.el8.noarch                        stratisd-1.0.0-2.el8.x86_64                              python3-dbus-client-gen-0.3-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!

Make sure that the stratisd service is enabled and running

[root@node4 dvd]# systemctl enable --now stratisd
Created symlink /etc/systemd/system/sysinit.target.wants/stratisd.service → /usr/lib/systemd/system/stratisd.service.

[root@node4 dvd]# systemctl status stratisd
● stratisd.service - A daemon that manages a pool of block devices to create flexible file systems
   Loaded: loaded (/usr/lib/systemd/system/stratisd.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-06-17 11:57:24 IST; 10s ago
     Docs: man:stratisd(8)
 Main PID: 11631 (stratisd)
    Tasks: 1 (limit: 24008)
   Memory: 756.0K
   CGroup: /system.slice/stratisd.service
           └─11631 /usr/libexec/stratisd --debug

Jun 17 11:57:24 node4.example systemd[1]: Started A daemon that manages a pool of block devices to create flexible file systems.
Jun 17 11:57:24 node4.example stratisd[11631]: DEBUG libstratis::stratis::buff_log: BuffLogger: pass_through: true hold time: none
Jun 17 11:57:24 node4.example stratisd[11631]:  INFO stratisd: Using StratEngine
Jun 17 11:57:24 node4.example stratisd[11631]: DEBUG stratisd: Engine state:
Jun 17 11:57:24 node4.example stratisd[11631]: StratEngine {
Jun 17 11:57:24 node4.example stratisd[11631]:     pools: {},
Jun 17 11:57:24 node4.example stratisd[11631]:     incomplete_pools: {},
Jun 17 11:57:24 node4.example stratisd[11631]:     watched_dev_last_event_nrs: {}
Jun 17 11:57:24 node4.example stratisd[11631]: }
Jun 17 11:57:24 node4.example stratisd[11631]:  INFO stratisd: DBUS API is now available

 

Pre-requisites

Now our service is up and running successfully. Next we need devices on which we will create the stratis file system. Here I have added three virtual disks on my RHEL 8 virtual machine.

[root@node4 ~]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0    8G  0 disk
├─sda1          8:1    0  512M  0 part /boot
└─sda2          8:2    0  7.5G  0 part
  ├─rhel-root 253:0    0  6.6G  0 lvm  /
  └─rhel-swap 253:1    0  956M  0 lvm  [SWAP]
sdb             8:16   0    2G  0 disk
sdc             8:32   0    2G  0 disk
sdd             8:48   0    2G  0 disk
sr0            11:0    1  6.5G  0 rom
sr1            11:1    1 1024M  0 rom

If the selected block device contains file system, partition table, or RAID signatures, erase them:

[root@node4 ~]# wipefs -a /dev/sdb /dev/sdc /dev/sdd

To create a Stratis pool on the block device, use:

[root@node4 ~]# stratis pool create my-pool /dev/sdb /dev/sdc

Here I am creating a new pool with the name "my-pool" which will contain /dev/sdb and /dev/sdc block devices

To check the list of block devices part of stratis on your system:

[root@node4 ~]# stratis blockdev list
Pool Name  Device Node    Physical Size       State  Tier
my-pool    /dev/sdb               2 GiB  Not-in-use  Data
my-pool    /dev/sdc               2 GiB      In-use  Data

To verify, list all pools on your system:

[root@node4 ~]# stratis pool list
Name       Total Physical Size  Total Physical Used
my-pool                  4 GiB               56 MiB

 

Add block device to existing pool

Next to add one or more block devices to the existing pool, use:

[root@node4 ~]# stratis pool add-data my-pool /dev/sdd

Here I am adding /dev/sdd to my existing pool i.e. my-pool

Next verify the list of block devices part of stratis pool

[root@node4 ~]# stratis blockdev list
Pool Name  Device Node    Physical Size       State  Tier
my-pool    /dev/sdb               2 GiB  Not-in-use  Data
my-pool    /dev/sdc               2 GiB      In-use  Data
my-pool    /dev/sdd               2 GiB  Not-in-use  Data

 

Create Stratis file system

This procedure creates a Stratis file system on an existing pool.

[root@node4 ~]# stratis filesystem create my-pool test-fs1
[root@node4 ~]# stratis filesystem create my-pool test-fs2

Here test-fs1 and test-fs2 are the two file systems which I have created under my-pool.

To verify, list file systems within the pool:

[root@node4 ~]# stratis filesystem list
Pool Name  Name      Used     Created            Device
my-pool    test-fs1  546 MiB  Jun 17 2019 12:05  /dev/stratis/my-pool/test-fs1
my-pool    test-fs2  546 MiB  Jun 17 2019 12:06  /dev/stratis/my-pool/test-fs2

You can also use below command to list the file systems available in the pool:

[root@node4 ~]# stratis fs list
Pool Name  Name      Used     Created            Device
my-pool    test-fs1  546 MiB  Jun 17 2019 12:05  /dev/stratis/my-pool/test-fs1
my-pool    test-fs2  546 MiB  Jun 17 2019 12:06  /dev/stratis/my-pool/test-fs2

 

Mount Stratis file system

This procedure mounts an existing Stratis file system to access the content. Currently my node contains the below partitions and file systems.

[root@node4 ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
devtmpfs               1.9G     0  1.9G   0% /dev
tmpfs                  1.9G     0  1.9G   0% /dev/shm
tmpfs                  1.9G  8.5M  1.9G   1% /run
tmpfs                  1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-root  6.4G  1.4G  4.8G  23% /
/dev/sda1              488M  124M  329M  28% /boot
tmpfs                  379M     0  379M   0% /run/user/0

Now I will create new mount points for the two stratis file systems which we created above. I will create directories under / with below names

[root@node4 ~]# mkdir /test-fs1
[root@node4 ~]# mkdir /test-fs2

Now since I have two mount points available, use the entries that Stratis maintains in the /dev/stratis/ directory under "Device":

[root@node4 ~]# stratis fs list
Pool Name  Name      Used     Created            Device
my-pool    test-fs1  546 MiB  Jun 17 2019 12:05  /dev/stratis/my-pool/test-fs1
my-pool    test-fs2  546 MiB  Jun 17 2019 12:06  /dev/stratis/my-pool/test-fs2

[root@node4 ~]# mount /dev/stratis/my-pool/test-fs1 /test-fs1/
[root@node4 ~]# mount  /dev/stratis/my-pool/test-fs2 /test-fs2/

To verify if the stratis file systems are successfully mounted:

[root@node4 ~]# df -h
Filesystem                                                                                       Size  Used Avail Use% Mounted on
devtmpfs                                                                                         1.9G     0  1.9G   0% /dev
tmpfs                                                                                            1.9G     0  1.9G   0% /dev/shm
tmpfs                                                                                            1.9G  8.5M  1.9G   1% /run
tmpfs                                                                                            1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/rhel-root                                                                            6.4G  1.4G  4.8G  23% /
/dev/sda1                                                                                        488M  124M  329M  28% /boot
tmpfs                                                                                            379M     0  379M   0% /run/user/0
/dev/mapper/stratis-1-a35d85c5802c49b59bb8c81104d43bb4-thin-fs-0f6d34239dcb4955803a1054c3a65972  1.0T  7.2G 1017G   1% /test-fs2
/dev/mapper/stratis-1-a35d85c5802c49b59bb8c81104d43bb4-thin-fs-bf11c663d9da4bc390a81440a9184312  1.0T  7.2G 1017G   1% /test-fs1

To check the space available in the pool

[root@node4 ~]# stratis pool list
Name       Total Physical Size  Total Physical Used
my-pool                  6 GiB             1.12 GiB

So in this case total pool size is 6 GB and only 1.2 GB is used.

To check the space occupied by the file system:

[root@node4 ~]# stratis filesystem list
Pool Name  Name      Used     Created            Device
my-pool    test-fs1  546 MiB  Jun 17 2019 12:05  /dev/stratis/my-pool/test-fs1
my-pool    test-fs2  546 MiB  Jun 17 2019 12:06  /dev/stratis/my-pool/test-fs2

Here as you see the file system uses 546 MB in size.

 

Persistently mounting a Stratis file system

This procedure persistently mounts a Stratis file system so that it is available automatically after booting the system. get the UUID for the available stratis file systems using lsblk command:

[root@node4 ~]# lsblk --output=UUID /dev/stratis/my-pool/test-fs1
UUID
bf11c663-d9da-4bc3-90a8-1440a9184312

[root@node4 ~]# lsblk --output=UUID /dev/stratis/my-pool/test-fs2
UUID
0f6d3423-9dcb-4955-803a-1054c3a65972

As root, edit the /etc/fstab file and add a line for the file system, identified by the UUID. Use xfs as the file system type and add the x-systemd.requires=stratisd.service option.

[root@node4 ~]# vim /etc/fstab
UUID=bf11c663-d9da-4bc3-90a8-1440a9184312       /test-fs1       xfs     defaults,x-systemd.requires=stratisd.service   0 0
UUID=0f6d3423-9dcb-4955-803a-1054c3a65972       /test-fs2       xfs     defaults,x-systemd.requires=stratisd.service   0 0

Next unmount the stratis file system to verify the changes

[root@node4 ~]# umount /test-fs1
[root@node4 ~]# umount /test-fs2/

[root@node4 ~]# df -h | egrep test-fs1|test-fs2

Regenerate mount units so that your system registers the new configuration:

[root@node4 ~]# systemctl daemon-reload

Try mounting the file system to verify that the configuration works:

[root@node4 ~]# mount -a

So all the partitions under our fstab has been successfully mounted including stratis file systems

[root@node4 ~]# df -h | egrep test-fs1|test-fs2
/dev/mapper/stratis-1-a35d85c5802c49b59bb8c81104d43bb4-thin-fs-bf11c663d9da4bc390a81440a9184312  1.0T  7.2G 1017G   1% /test-fs1
/dev/mapper/stratis-1-a35d85c5802c49b59bb8c81104d43bb4-thin-fs-0f6d34239dcb4955803a1054c3a65972  1.0T  7.2G 1017G   1% /test-fs2

 

Lastly I hope the steps from the article to understand Stratis Architecture, create stratis file system with thin provision, creating pool and mounting the stratis file system to access the data on RHEL 8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.

 

In the next article I will share the steps to create snapshot, restore file system using snapshot, remove or destroy pools, file systems and other commands on RHEL 8 Linux.

 

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can reach out to him on his LinkedIn profile or join on Facebook page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

1 thought on “Create Stratis File System (thin provision) with examples (CentOS/RHEL 8)”

Leave a Comment

X