What is Stratis?
- Introduced in RHEL 8 as a next-generation Linux storage management solution.
- Uses thin provisioning by default.
- Combines storage management and filesystem management into one solution.
- Automatically grows a filesystem when more space is needed, provided the pool has available capacity.
Key difference from LVM: Stratis automatically manages filesystem growth within the available pool, while traditional LVM generally requires LV extension and filesystem resizing.
Implementation
-
Install Stratis
dnf install stratis-cli stratisd -y
-
stratis-cli: Provides commands to manage Stratis. stratisd: Stratis background service (daemon).
-
-
Enable and Start Stratis Service
systemctl enable --now stratisdsystemctl status stratisd
- Starts the Stratis service immediately.
- Enables it to start automatically after reboot.
-
Add two new 8GB Disks
- Add two 8GB disks using virtualization software.
- Verify that Linux detects the new disks.
lsblkfdisk -l
Example:
-
/dev/nvme3n1 /dev/nvme4n1
-
Create a Stratis Pool
stratis pool create pgdata_pool /dev/nvme3n1stratis pool list
Why create a pool?
- A pool is a storage collection built from one or more physical disks.
- It provides the storage capacity used to create Stratis filesystems.
- Think of it as a storage container that manages the underlying disks.
-
Extend the Pool
stratis pool add-data pgdata_pool /dev/nvme4n1stratis pool list
Why extend a pool?
- Adds another physical disk to the existing pool.
- Increases the available storage capacity.
- Allows filesystems in the pool to use the additional capacity.
-
Create a Stratis Filesystem
stratis filesystem create pgdata_pool postgres_datastratis filesystem list
Why create a filesystem?
- A pool provides storage capacity, but it is not directly used to store files.
- A filesystem provides the usable storage structure where Linux can store directories and files.
- Stratis automatically creates an XFS filesystem by default.
-
Create a Mount Point and Mount the Filesystem
mkdir -p /pgdatamount /dev/stratis/pgdata_pool/postgres_data /pgdata
Why mount it?
- A mount point is a directory used to access the filesystem.
- After mounting, applications can store data under
/pgdata.
-
Verify
df -Thstratis filesystem list
df -Th: Displays mounted filesystems, filesystem types, and available space.stratis filesystem list: Displays Stratis filesystems and their sizes.
-
Create a Filesystem Snapshot
stratis filesystem snapshot pgdata_pool postgres_data postgres_data_snapVerify
stratis filesystem list
Why create a snapshot?
- A snapshot captures the filesystem’s state at a particular point in time.
- Useful before maintenance, upgrades, or configuration changes.
- Allows you to access the previous state if something goes wrong.
-
Configure Automatic Mount at Boot
Step 1: Get the filesystem UUID
blkid /dev/stratis/pgdata_pool/postgres_dataStep 2: Edit /etc/fstab
vi /etc/fstabAdd
UUID=1d3f9419-e452-43a4-b757-1ded66b244ea /pgdata xfs defaults,x-systemd.requires=stratisd.service 0 0
Why use
/etc/fstab?/etc/fstabdefines filesystems that Linux should mount automatically during boot.- Without this entry, you would need to mount the filesystem manually after reboot.
-
Test Automatic Mounting
systemctl daemon-reloadumount /pgdatamount -adf -Th
daemon-reload: Reloads systemd configuration.umount /pgdata: Temporarily unmounts the filesystem.mount -a: Mounts filesystems configured in/etc/fstab.df -Th: Verifies that the filesystem is mounted.
-
Add more storage to an existing stratis Pool
Scenario: Your existing pgdata_pool has two 8GB disks, but you need another 8GB of storage.
Step 1: Add a new 8GB disk
- Add a new 8GB disk using virtualization software.
-
Verify that Linux detects it.
lsblkfdisk -l
Example:
/dev/nvme5n1
Step 2: Add the new disk to the existing pool
stratis pool add-data pgdata_pool /dev/nvme5n1
- Adds the new disk to
pgdata_pool. - Increase the pool’s available storage capacity.
Step 3: Verify the pool
stratis pool liststratis blockdev list pgdata_pool