Red Hat Certified System Administrator(RHCSA)
Create and Configure File Systems
Manage layered storage
In this lesson, you will learn how to manage layered storage using Stratis—an advanced storage management tool for Linux. Stratis simplifies working with pools of physical storage, making it easier to configure, deploy, and manage complex storage scenarios.
Stratis efficiently handles pools of disks or partitions (block devices) and allows you to create volumes within those pools. These pools enable powerful features such as filesystem snapshots, thin provisioning, and tiering.
While similar to LVM, Stratis offers a simpler and more straightforward approach. It utilizes the XFS filesystem for managing file systems.
Warning
Do not use traditional XFS command-line tools on filesystems managed by Stratis, as this may lead to unexpected behavior.
Installing and Starting Stratis
If Stratis is not yet installed on your machine, you can easily add it using YUM. Install both the stratisd
daemon and the stratis-cli
command-line interface. Then, start and enable the Stratis service to run automatically at boot time:
sudo yum install stratisd stratis-cli
sudo systemctl enable --now stratisd.service
Creating a Storage Pool
After installation, verify that you have one or more available block devices (unmounted and not in use) for creating a storage pool. Use the commands below to create a pool.
To create a pool from a single block device:
sudo stratis pool create my-pool /dev/vdc
To create a pool using multiple block devices (for example, /dev/vdc
and /dev/vdd
), list them on the same command line:
sudo stratis pool create my-pool /dev/vdc /dev/vdd
Verify your pool and review its properties:
sudo stratis pool list
Creating a Filesystem
Before storing data, you need to create a filesystem within the pool. In the example below, a filesystem named myfs1
is created in the pool my-pool
:
sudo stratis fs create my-pool myfs1
After creation, inspect the filesystem details:
sudo stratis fs
This command displays useful information such as the pool name, filesystem name, space usage, creation timestamp, and the device path (commonly in the format /dev/stratis/<pool>/<filesystem>
).
Mounting the Filesystem
To access and use the new filesystem, follow these steps:
Create a mount directory:
sudo mkdir /mnt/mystratis
Open the
/etc/fstab
file with a text editor (for example, vi):sudo vi /etc/fstab
Add the following line to ensure the filesystem mounts automatically at boot time:
/dev/stratis/my-pool/myfs1 /mnt/mystratis xfs x-systemd.requires=stratisd.service 0 0
Mount all filesystems defined in
/etc/fstab
:sudo mount -a
You can now use your mounted Stratis filesystem. For instance, to copy a file (/home/aaron/mydata.txt
) to the mounted location:
sudo cp /home/aaron/mydata.txt /mnt/mystratis
Expanding the Storage Pool
When you need additional space, Stratis allows you to add new block devices to an existing pool easily. For example, to add the block device /dev/vdd
to the pool my-pool
, execute:
sudo stratis pool add-data my-pool /dev/vdd
Check the updated pool information after adding the new data device:
sudo stratis pool list
Stratis automatically manages filesystem size adjustments when new storage is incorporated.
Creating and Restoring Filesystem Snapshots
Stratis supports the creation of snapshots for filesystems, providing an effective method for backups and recovery. To create a snapshot of myfs1
in the pool my-pool
, run:
sudo stratis fs snapshot my-pool myfs1 myfs1-snapshot
Verify the snapshot creation by listing the filesystem details:
sudo stratis fs
Both the original filesystem (myfs1
) and its snapshot (myfs1-snapshot
) should appear.
Using Snapshots for Data Recovery
Note
Filesystem snapshots are a powerful tool for quickly recovering lost or accidentally deleted data.
If you accidentally delete data (for example, /mnt/mystratis/mydata.txt
), follow these steps to restore from the snapshot:
Remove the deleted file (if not already deleted):
rm /mnt/mystratis/mydata.txt
Rename the current filesystem (e.g., to
myfs1-old
):sudo stratis fs rename my-pool myfs1 myfs1-old
Rename the snapshot to use the original filesystem name:
sudo stratis fs rename my-pool myfs1-snapshot myfs1
Unmount and then remount the filesystem:
sudo umount /mnt/mystratis sudo mount /mnt/mystratis
Verify the recovery:
sudo stratis fs ls /mnt/mystratis
You should now see that mydata.txt
has been restored as part of the recovered filesystem. Stratis snapshots offer an efficient method to back up data and ensure swift recovery in critical situations.
This concludes our lesson on managing layered storage with Stratis. For more detailed information and advanced usage, consider reviewing the Stratis documentation and additional Linux storage management resources.
Watch Video
Watch video content
Practice Lab
Practice lab