Using stratis to manage local storage in centos8 (1)

Time:2021-12-31

Stratis is a new local storage management tool provided in rhel8 / centos8, which will help create tiered storage on block devices. In rhel8 / centos8, stratis can be obtained by installing two packages. In rhel7, we have Btrfs file system. Red hat removes Btrfs support in RHEL 8 and provides stratis local storage management system.
In order to start using stratis, we need to add some disk devices and create a separate pool in which multiple file systems can be created.

Installing stratis
Install stratis using Yum using the following command:

[[email protected] ~]# yum -y install stratis*
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
After the installation is completed, set the boot to enable and start immediately:

[[email protected] ~]# systemctl enable stratisd –now
Check whether the following are started:
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)

List available disks
Five 2GB disks are added here. Use the following command to list the disks:

[[email protected] ~]# lsblk
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)

List existing pools and file systems:
Use the following commands to list block devices, stratis pools, and file systems:

[[email protected] ~]# stratis blockdev list
[[email protected] ~]# stratis pool list
[[email protected] ~]# stratis filesystem list
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)

Create pools and file systems
First, we create a pool of “data01_pool”. Add / dev / SDA, / dev / SDB, / dev / SDC, / dev / SDD to the pool:

[[email protected] ~]# stratis pool create data01_pool /dev/sd{a..d}
[[email protected] ~]# stratis pool list
[[email protected] ~]# stratis blockdev list
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
The above commands create “data01_pool” pool, view pool and view block devices.

Next, create two file systems from the “data01_pool” pool:

[[email protected] ~]# stratis filesystem create data01_pool user_data01
[[email protected] ~]# stratis filesystem create data01_pool user_data02
Using stratis to manage local storage in centos8 (1)
The following command lists the file systems created:

[[email protected] ~]# stratis filesystem list
perhaps
[[email protected] ~]# stratis fs list
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
In the file system listed above, the device field is the location of the stratis device.

Mount the created file system
Once you have created a file system from the pool, create a mount point and mount the file system. By default, when you create a file system, it formats it using the XFS file system.

Create mount point

[[email protected] ~]# mkdir /user_data01
[[email protected] ~]# mkdir /user_data02

Mount file system

[[email protected] ~]# mount /stratis/data01_pool/user_data01 /user_data01/
[[email protected] ~]# mount /stratis/data01_pool/user_data02 /user_data02/
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
Use DF – h to view the mount:

[[email protected] ~]# df -h /user_data*
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-0657c26979ed443aa4d3a70c15606e1c 1.0T 7.2G 1017G 1% /user_data01
/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-b91b970f23d94eb6b2ed56f347f770d2 1.0T 7.2G 1017G 1% /user_data02
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
I hope you’ve observed that we don’t have a formatted file system. The stratis program solves this problem for us and creates an XFS type file system.

Similarly, due to thin provisioning, by default, it will display a file system size of 1 TB, and the size is only virtual, not actual. To check the actual size, you will have to use the stratis command

Match user with DF – HT / user *_ Data01 and user_ According to the file system of data02 mount point, you can see that their types are in XFS format.
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)

Add the boot mount entry in / etc / fstab
First, you need to obtain the UUID of the file system in two ways:

The first way is to obtain the UUID of the file system by using stratis FS list.

[[email protected] ~]# stratis fs list
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
The second way is to use blkid to obtain the UUID stored in the block and filter out the stratis file system:

[[email protected] ~]# blkid|grep stratis
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
The following is to write the hang information to / etc / fstab:

[[email protected] ~]# echo “UUID=0657c26979ed443aa4d3a70c15606e1c /user_data01 xfs defaults,x-systemd.requires=stratis.service 0 0” >> /etc/fstab
[[email protected] ~]# echo “UUID=b91b970f23d94eb6b2ed56f347f770d2 /user_data02 xfs defaults,x-systemd.requires=stratis.service 0 0” >> /etc/fstab
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)
Using stratis to manage local storage in centos8 (1)
Check the stratis daemon version
If you need to check the version of the daemon that stratis is running, use the following command:

[[email protected] ~]# stratis daemon version
2.1.0
Using stratis to manage local storage in centos8 (I) using stratis to manage local storage in centos8 (I)

summary
Stratis is a new local storage management tool provided in rhel8 / centos8, which will help create tiered storage on block devices. In rhel8 / centos8, stratis can be obtained by installing two packages.