Skip to content

Latest commit

 

History

History
2974 lines (2259 loc) · 69.5 KB

stratis.md

File metadata and controls

2974 lines (2259 loc) · 69.5 KB
title STRATIS - Modern Local Storage Management for Linux
description Complete guide to STRATIS - Modern Local Storage Management for Linux
category Storage
tags
storage
disk management
lvm
partitioning
systemd
firewall
difficulty beginner
last_updated 2026-06-06
related_commands

STRATIS - Modern Local Storage Management for Linux

Table of Contents

  1. Introduction
  2. What is Stratis?
  3. Stratis vs Traditional Storage
  4. Architecture Overview
  5. Target Distributions
  6. Installation
  7. Basic Concepts
  8. Basic Operations
  9. Pool Management
  10. Filesystem Management
  11. Snapshots
  12. Advanced Features
  13. Encryption Support
  14. Monitoring and Troubleshooting
  15. Stratis vs LVM Comparison
  16. When to Use Stratis
  17. systemd Integration
  18. Best Practices
  19. RHEL 9/10 Specific Features
  20. Troubleshooting Guide
  21. Interview Questions

Introduction

What is Stratis?

Stratis is a modern, easy-to-use local storage management solution for Linux that simplifies storage administration while providing advanced features. It is designed as a volume manager that combines existing Linux technologies (XFS, device-mapper, LVM concepts) behind a unified, user-friendly API.

Key Characteristics

  • Simplicity - Easy-to-use CLI and API compared to manual LVM+XFS setup
  • Modern Design - Built with current best practices and modern Linux storage stack
  • Automatic Management - Handles complex storage tasks automatically
  • Thin Provisioning - All filesystems are thinly provisioned by default
  • Snapshots - Easy XFS snapshot creation and management
  • Encryption - Integrated LUKS encryption support
  • D-Bus API - Programmatic access via D-Bus

Purpose

Stratis was created to provide:

  1. Simplified Storage Management - Reduce complexity of storage administration
  2. Modern Defaults - Automatic best practices (thin provisioning, XFS)
  3. Unified Interface - Single API for all storage operations
  4. Enterprise Features - Snapshots, encryption, monitoring without complexity
  5. Future-Proof Design - Foundation for next-generation storage features

What is Stratis?

Overview

Stratis is NOT a traditional filesystem or volume manager replacement. Instead, it is a local storage management service that:

Traditional Approach:
User → LVM commands → Device Mapper → Block Device → XFS/ext4

Stratis Approach:
User → stratis CLI → stratisd daemon → Device Mapper + XFS
                   ↓
                D-Bus API (for automation)

Core Components

  1. stratisd - Background daemon (written in Rust)

    • Manages pools and filesystems
    • Handles device-mapper operations
    • Provides D-Bus API
    • Monitors storage health
  2. stratis-cli - Command-line interface (Python)

    • User-facing commands
    • Communicates with stratisd via D-Bus
    • Human-readable output
  3. Backend Technologies

    • XFS - Filesystem layer (always XFS)
    • Device Mapper - Block device management
    • LVM Concepts - Thin provisioning logic
    • LUKS - Optional encryption

Design Philosophy

Stratis is designed around three principles:

  1. Ease of Use - Simple commands for common tasks
  2. Automation - Automatic thin provisioning, extent management
  3. Safety - Prevent common user errors with validation

Stratis vs Traditional Storage

Traditional LVM + XFS Workflow

# Traditional approach (11 commands minimum)
pvcreate /dev/sdb
vgcreate vg_data /dev/sdb
lvcreate -L 100G -n lv_app vg_data
mkfs.xfs /dev/vg_data/lv_app
mkdir /app
mount /dev/vg_data/lv_app /app
echo '/dev/vg_data/lv_app /app xfs defaults 0 0' >> /etc/fstab

# Snapshot creation (complex)
lvcreate -s -L 10G -n lv_app_snap /dev/vg_data/lv_app
mkdir /mnt/snap
mount /dev/vg_data/lv_app_snap /mnt/snap

Stratis Workflow

# Stratis approach (4 commands)
stratis pool create pool_data /dev/sdb
stratis filesystem create pool_data app
mkdir /app
mount /stratis/pool_data/app /app

# Snapshot creation (simple)
stratis filesystem snapshot pool_data app app_snap
mkdir /mnt/snap
mount /stratis/pool_data/app_snap /mnt/snap

Comparison Table

Feature Traditional (LVM+XFS) Stratis
Complexity High (3+ layers to manage) Low (single interface)
Thin Provisioning Manual configuration Automatic (default)
Snapshots Manual LVM snapshots Simple XFS snapshots
Commands to Learn 20+ (pv*, vg*, lv*, mkfs, mount) ~10 stratis commands
Filesystem Choice Any (ext4, XFS, etc.) XFS only
Encryption Manual LUKS setup Integrated
API Access None (CLI only) D-Bus API
Monitoring Manual (lvs, vgs, pvs) Built-in
Overprovision Detection Manual calculation Automatic warnings

Architecture Overview

Layered Architecture

┌─────────────────────────────────────────────────────────────┐
│                    APPLICATION LAYER                        │
│              (Files accessed via mounted XFS)               │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│                    FILESYSTEM LAYER                         │
│         XFS filesystems in /stratis/pool_name/              │
│         (Always XFS, thin-provisioned)                      │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│                    STRATIS SERVICE LAYER                    │
│    stratisd daemon - Pool & Filesystem Management          │
│    ├─ D-Bus API (programmatic access)                      │
│    ├─ Thin Provisioning Engine                             │
│    ├─ Snapshot Management                                  │
│    └─ Monitoring & Health Checks                           │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│                    DEVICE MAPPER LAYER                      │
│    Device Mapper Thin Provisioning (dm-thin)               │
│    ├─ Thin Pool (metadata + data)                          │
│    ├─ Thin Volumes (filesystems)                           │
│    └─ Snapshot Management                                  │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│                    BLOCK DEVICE LAYER                       │
│    Physical Devices: /dev/sdb, /dev/sdc, etc.              │
│    Optional: LUKS encryption (dm-crypt)                    │
└─────────────────────────────────────────────────────────────┘

Stratis Pool Structure

Stratis Pool: "pool_data"
│
├─ Block Devices (Data Tier)
│  ├─ /dev/sdb (500 GB)
│  ├─ /dev/sdc (500 GB)
│  └─ /dev/sdd (1 TB)
│  Total: 2 TB physical storage
│
├─ Device Mapper Thin Pool
│  ├─ Metadata Device (automatic sizing)
│  └─ Data Device (uses all block devices)
│
├─ Filesystems (Thin Volumes)
│  ├─ app1 (virtual size: 100 GB, actual: 45 GB)
│  ├─ app2 (virtual size: 500 GB, actual: 230 GB)
│  ├─ app3 (virtual size: 200 GB, actual: 85 GB)
│  └─ backups (virtual size: 1 TB, actual: 450 GB)
│  Virtual Total: 1.8 TB (90% overprovisioned)
│  Actual Used: 810 GB / 2 TB (40.5% real usage)
│
└─ Snapshots (stored as thin volumes)
   ├─ app1_snap_2026-06-01
   └─ app2_snap_pre_upgrade

Data Flow

Write Operation:
User writes to /stratis/pool_data/app1/file.txt
         ↓
XFS filesystem processes write
         ↓
Device mapper thin volume allocates blocks (if needed)
         ↓
Data written to physical device (/dev/sdb)
         ↓
stratisd updates metadata and monitoring

Target Distributions

Officially Supported

Distribution First Version Status Notes
RHEL RHEL 8.0 Fully Supported Technology Preview in 8.0-8.2, Supported from 8.3+
RHEL 9 RHEL 9.0 Fully Supported Enhanced features, stable
RHEL 10 RHEL 10 Beta Fully Supported Latest features
Fedora Fedora 28 Supported Bleeding edge features
CentOS Stream Stream 8/9 Supported Upstream for RHEL

Version Requirements

RHEL 8:

  • Minimum: RHEL 8.0 (Tech Preview)
  • Recommended: RHEL 8.3+ (Full Support)
  • Latest: RHEL 8.10 (all features)

RHEL 9:

  • All versions fully supported
  • Enhanced encryption
  • Improved performance
  • Better monitoring

RHEL 10:

  • Next-generation features
  • Performance improvements
  • Enhanced integration

Fedora:

  • Fedora 28+ (initial support)
  • Fedora 35+ (recommended for stability)
  • Latest Fedora (cutting edge)

Distribution-Specific Notes

RHEL 8.0-8.2 (Technology Preview):

  • Not supported for production
  • Missing some features
  • Upgrade to 8.3+ recommended

RHEL 8.3+:

  • Full support
  • Production-ready
  • All core features available

RHEL 9:

  • Default in new installations
  • Enhanced encryption (LUKS2)
  • Better systemd integration
  • Improved monitoring tools

RHEL 10:

  • Latest daemon improvements
  • Enhanced performance
  • Future-proof features

Installation

RHEL/CentOS Stream

# Install Stratis packages
sudo dnf install stratisd stratis-cli

# Enable and start the daemon
sudo systemctl enable --now stratisd

# Verify installation
stratis --version
stratis pool list  # Should return empty (no pools yet)

# Check daemon status
sudo systemctl status stratisd

Fedora

# Install (usually pre-installed on Fedora Workstation)
sudo dnf install stratisd stratis-cli

# Enable and start
sudo systemctl enable --now stratisd

# Verify
stratis --version

Package Details

Main Packages:

  • stratisd - Daemon (Rust binary)
  • stratis-cli - CLI tool (Python)

Dependencies (auto-installed):

  • device-mapper
  • xfsprogs
  • cryptsetup (for encryption)
  • Python D-Bus libraries

Post-Installation Verification

# Check stratisd is running
sudo systemctl is-active stratisd
# Output: active

# Check D-Bus interface
busctl list | grep stratis
# Output: org.storage.stratis3

# Verify CLI can communicate with daemon
stratis daemon version
# Output: 3.6.0 (example)

# Check available block devices
lsblk -e7 -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT

Firewall Configuration

Stratis uses local D-Bus only (no network ports), so no firewall configuration is needed.


Basic Concepts

Pools

Definition: A pool is a collection of one or more block devices managed as a single storage unit.

Characteristics:

  • Named storage container
  • Contains one or more block devices
  • Provides storage for filesystems
  • Thin-provisioned by default
  • Can be expanded by adding devices

Example:

# Pool named "tank" using two disks
stratis pool create tank /dev/sdb /dev/sdc
Pool: "tank"
├─ Block Device: /dev/sdb (500 GB)
├─ Block Device: /dev/sdc (500 GB)
└─ Total Capacity: 1 TB

Filesystems

Definition: A filesystem is a thin-provisioned XFS filesystem created within a pool.

Characteristics:

  • Always XFS (no choice)
  • Thinly provisioned (virtual size vs actual size)
  • Can be larger than pool size (overprovisioning)
  • Mounted in /stratis/pool_name/filesystem_name
  • No size limits specified at creation (grows as needed)

Example:

# Create filesystem "data" in pool "tank"
stratis filesystem create tank data
# Mounted at: /stratis/tank/data

Block Devices (blockdev)

Definition: Physical or virtual block devices added to a pool.

Supported Types:

  • Physical disks (/dev/sdb, /dev/sdc)
  • Partitions (/dev/sdb1)
  • RAID arrays (/dev/md0)
  • LUNs from SAN storage
  • Virtual disks (VMs)
  • Loop devices (testing only)

Requirements:

  • Must be unformatted
  • Must not be in use
  • Minimum size: 1 GB
  • Recommended: 16 GB+

Thin Provisioning

How it Works:

Filesystem Virtual Size: 1 TB
Actual Data Written: 250 GB
Physical Storage Allocated: 250 GB (only what's used)

User sees: 1 TB filesystem
Pool uses: 250 GB real space

Benefits:

  • Efficient space utilization
  • Overprovisioning allowed
  • Dynamic allocation
  • Easy snapshots

Risks:

  • Pool can run out of space if overprovisioned
  • Requires monitoring

Snapshots

Definition: Read-write point-in-time copy of a filesystem.

Characteristics:

  • XFS-based (not LVM snapshots)
  • Instant creation (copy-on-write)
  • Fully writable
  • Shares blocks with parent until modified
  • Independent filesystem after creation

Use Cases:

  • Backups before changes
  • Testing/development
  • Rollback capability

Basic Operations

Creating Your First Pool and Filesystem

Complete Workflow:

# 1. Identify available disks
lsblk -e7

# 2. Create pool with one or more devices
sudo stratis pool create mypool /dev/sdb

# 3. Verify pool creation
stratis pool list
# NAME     TOTAL PHYSICAL   PROPERTIES
# mypool   500 GiB         ~Ca,~Cr

# 4. Create filesystem
sudo stratis filesystem create mypool data

# 5. Verify filesystem
stratis filesystem list
# Pool     Name    Used      Created             Device
# mypool   data    546 MiB   Jun 06 2026 10:00   /stratis/mypool/data

# 6. Create mount point
sudo mkdir -p /data

# 7. Mount filesystem
sudo mount /stratis/mypool/data /data

# 8. Verify mount
df -h /data
# Filesystem                Size  Used Avail Use% Mounted on
# /dev/mapper/stratis-..    1.0T  546M 1000G   1% /data

# 9. Make mount persistent (add to /etc/fstab)
echo '/stratis/mypool/data /data xfs defaults 0 0' | sudo tee -a /etc/fstab

# 10. Test persistence
sudo mount -a  # Should succeed without errors

Understanding the Output

Pool List Output:

stratis pool list
NAME     TOTAL PHYSICAL   PROPERTIES
mypool   500 GiB         ~Ca,~Cr

Properties Explained:

  • Ca = Cache (present if enabled, ~Ca = not enabled)
  • Cr = Encryption (present if encrypted, ~Cr = not encrypted)

Filesystem List Output:

stratis filesystem list
Pool     Name    Used      Created             Device
mypool   data    546 MiB   Jun 06 2026 10:00   /stratis/mypool/data

Fields Explained:

  • Pool = Parent pool name
  • Name = Filesystem name
  • Used = Actual physical space used
  • Created = Creation timestamp
  • Device = Symlink path for mounting

Pool Management

Creating Pools

Single Device:

sudo stratis pool create mypool /dev/sdb

Multiple Devices:

sudo stratis pool create mypool /dev/sdb /dev/sdc /dev/sdd

With Encryption (RHEL 9+):

# Create keyfile
echo -n "MySecurePassword" | sudo stratis key set --capture-key mykey

# Create encrypted pool
sudo stratis pool create --key-desc mykey mypool_encrypted /dev/sdb

Listing Pools

Basic List:

stratis pool list

Detailed Information:

# Show pool details
stratis pool list

# Show all block devices in pools
stratis blockdev list

# Show specific pool details
stratis pool list mypool

Adding Devices to Pool

Expand pool capacity:

# Add single device
sudo stratis pool add-data mypool /dev/sdd

# Add multiple devices
sudo stratis pool add-data mypool /dev/sde /dev/sdf

Verification:

stratis pool list
# Shows updated TOTAL PHYSICAL size

stratis blockdev list mypool
# Shows all devices in pool

Removing Devices from Pool

Important: Cannot remove devices if data is stored on them.

Not Currently Supported:

# This is NOT available in Stratis
# You cannot remove devices from a pool
# Workaround: Migrate data to new pool

Workaround - Migrate to New Pool:

# 1. Create new pool with desired devices
sudo stratis pool create newpool /dev/sde

# 2. Create filesystems in new pool
sudo stratis filesystem create newpool data

# 3. Copy data
sudo rsync -avxHAX /stratis/oldpool/data/ /stratis/newpool/data/

# 4. Update mount points
sudo umount /stratis/oldpool/data
sudo mount /stratis/newpool/data /data

# 5. Destroy old pool (after verification)
sudo stratis pool destroy oldpool

Renaming Pools

# Rename pool
sudo stratis pool rename oldname newname

# Verify
stratis pool list

Important: Update /etc/fstab if filesystems are mounted:

# Old entry
/stratis/oldname/data /data xfs defaults 0 0

# New entry (after rename)
/stratis/newname/data /data xfs defaults 0 0

Destroying Pools

WARNING: Destroys all filesystems and data in the pool.

# Unmount all filesystems first
sudo umount /stratis/mypool/data

# Destroy pool (confirmation required)
sudo stratis pool destroy mypool

Safe Destruction Workflow:

# 1. List filesystems in pool
stratis filesystem list mypool

# 2. Unmount all filesystems
sudo umount /stratis/mypool/data
sudo umount /stratis/mypool/logs

# 3. Remove from /etc/fstab
sudo vi /etc/fstab  # Remove stratis mount entries

# 4. Destroy pool
sudo stratis pool destroy mypool

# 5. Verify destruction
stratis pool list  # Should not show mypool
lsblk              # Devices should be available

Pool Information and Statistics

# Overview of all pools
stratis pool list

# Block devices in specific pool
stratis blockdev list mypool

# Filesystems in pool
stratis filesystem list mypool

# Detailed pool information (via D-Bus properties)
busctl get-property org.storage.stratis3 \
  /org/storage/stratis3/1 \
  org.storage.stratis3.pool.r4 \
  TotalPhysicalSize

Filesystem Management

Creating Filesystems

Basic Creation:

sudo stratis filesystem create mypool data

Create Multiple Filesystems:

sudo stratis filesystem create mypool app
sudo stratis filesystem create mypool logs
sudo stratis filesystem create mypool backups

Filesystems are created in:

/stratis/mypool/data
/stratis/mypool/app
/stratis/mypool/logs
/stratis/mypool/backups

Mounting Filesystems

Manual Mount:

sudo mkdir /data
sudo mount /stratis/mypool/data /data

Persistent Mount (recommended):

Add to /etc/fstab:

# Using symlink path (recommended)
/stratis/mypool/data    /data    xfs    defaults    0 0

# Using UUID (more reliable)
UUID=abc123...    /data    xfs    defaults    0 0

Get UUID:

lsblk -f | grep mypool
# Or
blkid /stratis/mypool/data

Systemd Mount Unit (alternative):

Create /etc/systemd/system/data.mount:

[Unit]
Description=Mount Stratis Filesystem
Requires=stratisd.service
After=stratisd.service

[Mount]
What=/stratis/mypool/data
Where=/data
Type=xfs
Options=defaults

[Install]
WantedBy=local-fs.target

Enable:

sudo systemctl enable --now data.mount

Renaming Filesystems

# Rename filesystem
sudo stratis filesystem rename mypool oldname newname

# Verify
stratis filesystem list mypool

After Renaming:

# Update mount point
sudo umount /stratis/mypool/oldname
sudo mount /stratis/mypool/newname /data

# Update /etc/fstab
/stratis/mypool/newname    /data    xfs    defaults    0 0

Destroying Filesystems

# Unmount first
sudo umount /data

# Destroy filesystem
sudo stratis filesystem destroy mypool data

# Verify
stratis filesystem list mypool

Filesystem Size and Usage

View Usage:

# Show actual space used
stratis filesystem list

# Show filesystem size as seen by OS
df -h /data

# Show detailed XFS statistics
xfs_info /data

Important Concept:

XFS reports virtual size: 1 TB (what df shows)
Actual physical usage: 150 GB (what stratis shows)
Thin provisioning difference: 850 GB (overprovisioning)

No Size Limits:

Stratis filesystems do NOT have fixed size limits. They grow as needed until:

  • Pool runs out of space
  • XFS maximum size (8 EB theoretical)
# You CANNOT do this with Stratis:
# stratis filesystem create --size 100G mypool data  # NO SIZE OPTION

# Instead, filesystems consume space as needed from pool

Filesystem Properties

View XFS Properties:

# Mounted filesystem info
xfs_info /data

# Filesystem geometry
xfs_info /stratis/mypool/data | grep -E 'bsize|agcount|agsize'

Modify XFS Properties:

# Set filesystem label
sudo xfs_admin -L "DATA_FS" /stratis/mypool/data

# View label
xfs_admin -l /stratis/mypool/data

Snapshots

Understanding Stratis Snapshots

Snapshot Characteristics:

  • Instant creation (copy-on-write at device-mapper level)
  • Full read-write filesystem
  • Independent of parent after creation
  • Can be mounted simultaneously with parent
  • Uses XFS on thin-provisioned volume
  • Shares blocks with parent until modified

Snapshot Architecture:

Pool: mypool
├─ Filesystem: data (original)
│  └─ Blocks: A, B, C, D
│
└─ Snapshot: data_backup
   └─ Blocks: A, B, C, D (shared initially)

After modification to data:
├─ Filesystem: data
│  └─ Blocks: A', B, C, D (A modified)
│
└─ Snapshot: data_backup
   └─ Blocks: A, B, C, D (original A preserved)

Creating Snapshots

Basic Snapshot:

sudo stratis filesystem snapshot mypool data data_backup

Timestamped Snapshot:

SNAP_NAME="data_$(date +%Y%m%d_%H%M%S)"
sudo stratis filesystem snapshot mypool data $SNAP_NAME

Verify Snapshot:

stratis filesystem list mypool
# Shows both original and snapshot

Mounting Snapshots

Mount for Inspection:

sudo mkdir /mnt/snapshot
sudo mount /stratis/mypool/data_backup /mnt/snapshot

# View snapshot contents
ls -la /mnt/snapshot

# Compare with original
diff -r /data /mnt/snapshot

Restoring from Snapshots

Method 1: Copy Data Back

# Mount snapshot (read-only for safety)
sudo mount -o ro /stratis/mypool/data_backup /mnt/snapshot

# Stop applications using /data
sudo systemctl stop myapp

# Restore data
sudo rsync -avxHAX --delete /mnt/snapshot/ /data/

# Restart applications
sudo systemctl start myapp

# Cleanup
sudo umount /mnt/snapshot

Method 2: Swap Mount Points

# Unmount original
sudo umount /data

# Mount snapshot in its place
sudo mount /stratis/mypool/data_backup /data

# Update /etc/fstab if needed
/stratis/mypool/data_backup    /data    xfs    defaults    0 0

# Optionally destroy old filesystem
sudo stratis filesystem destroy mypool data

# Rename snapshot to original name
sudo stratis filesystem rename mypool data_backup data

Method 3: Clone Snapshot to New Filesystem

# Create new filesystem from snapshot
sudo stratis filesystem snapshot mypool data_backup data_restored

# Mount for verification
sudo mount /stratis/mypool/data_restored /mnt/verify

# If good, swap mount points
sudo umount /data
sudo umount /mnt/verify
sudo mount /stratis/mypool/data_restored /data

Snapshot Best Practices

Pre-Change Snapshots:

# Before major system upgrade
sudo stratis filesystem snapshot mypool root root_pre_upgrade

# Before application deployment
sudo stratis filesystem snapshot mypool app app_pre_deploy_v2.1

Backup Strategy:

# Daily snapshots (automated via cron)
0 2 * * * /usr/local/bin/stratis-snapshot.sh

# stratis-snapshot.sh:
#!/bin/bash
POOL="mypool"
FS="data"
SNAP="${FS}_daily_$(date +\%Y\%m\%d)"
stratis filesystem snapshot $POOL $FS $SNAP

# Keep only last 7 days
# (cleanup old snapshots)

Snapshot Monitoring:

# Check snapshot space usage
stratis filesystem list mypool

# Monitor pool usage
stratis pool list

Destroying Snapshots

# Unmount if mounted
sudo umount /mnt/snapshot

# Destroy snapshot
sudo stratis filesystem destroy mypool data_backup

# Verify
stratis filesystem list mypool

Advanced Features

Thin Provisioning

Default Behavior:

All Stratis filesystems are thinly provisioned automatically.

# Create pool with 1 TB
sudo stratis pool create mypool /dev/sdb  # 1 TB disk

# Create filesystems (no size specified)
sudo stratis filesystem create mypool app1
sudo stratis filesystem create mypool app2
sudo stratis filesystem create mypool app3

# Each filesystem appears as 1 TB to the OS
df -h /stratis/mypool/app1  # Shows ~1 TB available

# But actual usage is only what's written
stratis filesystem list mypool
# app1: 50 GB used
# app2: 30 GB used
# app3: 20 GB used
# Total real usage: 100 GB / 1 TB pool

Overprovisioning:

You can create more virtual capacity than physical:

# Pool: 500 GB physical
# Create 5 filesystems, each appearing as 1 TB
# Total virtual: 5 TB
# Total physical: 500 GB
# Overprovisioning ratio: 10:1

Monitoring Overprovisioning:

# Check pool usage
stratis pool list
# mypool   500 GiB   ~Ca,~Cr

# Check actual filesystem usage
stratis filesystem list mypool

# Calculate overprovision ratio
# Virtual capacity / Physical capacity

Pool Expansion

Add Block Devices:

# Initial pool: 500 GB
sudo stratis pool create mypool /dev/sdb

# Later, add more capacity
sudo stratis pool add-data mypool /dev/sdc  # +500 GB
sudo stratis pool add-data mypool /dev/sdd  # +1 TB

# New pool size: 2 TB
stratis pool list
# mypool   2 TiB   ~Ca,~Cr

Filesystems automatically see new space:

# Filesystems expand automatically (thin provisioning)
df -h /stratis/mypool/data
# Available space increases automatically

No Filesystem Resize Needed:

Unlike traditional partitions or LVM, Stratis filesystems don't need manual resizing when pool grows.

Cache Tier (Optional)

Purpose: Use fast SSD as cache for slower HDD pool.

Adding Cache (RHEL 8.3+):

# Create pool with data devices (HDDs)
sudo stratis pool create mypool /dev/sdb /dev/sdc

# Add cache device (SSD)
sudo stratis pool init-cache mypool /dev/nvme0n1

# Verify cache
stratis pool list
# mypool   2 TiB   Ca,~Cr  ← Ca indicates cache enabled

Cache Architecture:

Fast Tier (Cache)
┌─────────────────────┐
│ SSD: /dev/nvme0n1   │  ← Hot data cached here
│ 500 GB              │
└─────────────────────┘
         ↕
Data Tier (Storage)
┌─────────────────────┐
│ HDD: /dev/sdb       │  ← Bulk storage
│ HDD: /dev/sdc       │
│ Total: 2 TB         │
└─────────────────────┘

Cache Behavior:

  • Automatic caching (no user intervention)
  • Write-through cache (data on HDD immediately)
  • Read caching for performance
  • Block-level caching

Adding Cache Devices to Existing Pool:

# Add more cache devices
sudo stratis pool add-cache mypool /dev/nvme0n2

Cache Statistics:

# View cache usage (via device mapper)
sudo dmsetup status | grep cache

Overprovision Monitoring

Built-in Warnings:

Stratis monitors pool usage and warns when overprovisioned pools are filling up.

Check Pool Status:

stratis pool list
# Shows TOTAL PHYSICAL size

stratis filesystem list
# Shows Used space per filesystem

# Calculate total used
# Sum all filesystem Used values

Set Up Monitoring:

# Monitor via systemd journal
sudo journalctl -u stratisd -f

# Stratisd logs warnings when pool fills:
# "Pool mypool is 80% full"
# "Pool mypool is 90% full - critically low"

Automated Monitoring Script:

#!/bin/bash
# /usr/local/bin/stratis-monitor.sh

POOL="mypool"
THRESHOLD=80

USAGE=$(stratis pool list | grep $POOL | awk '{print $2}' | sed 's/GiB//')
TOTAL=$(stratis blockdev list $POOL | awk 'NR>1 {sum+=$2} END {print sum/1024/1024/1024}')

PERCENT=$((USAGE * 100 / TOTAL))

if [ $PERCENT -gt $THRESHOLD ]; then
    echo "WARNING: Pool $POOL is ${PERCENT}% full"
    # Send alert (email, Slack, etc.)
fi

Cron Job:

# Check every hour
0 * * * * /usr/local/bin/stratis-monitor.sh

Encryption Support

LUKS Integration

Stratis integrates with LUKS (Linux Unified Key Setup) for block-level encryption.

Encryption Architecture:

┌─────────────────────────────────────┐
│     Stratis Filesystem (XFS)        │
└─────────────────────────────────────┘
               ↕
┌─────────────────────────────────────┐
│     Stratis Pool (dm-thin)          │
└─────────────────────────────────────┘
               ↕
┌─────────────────────────────────────┐
│  LUKS Encryption Layer (dm-crypt)   │  ← Encryption happens here
└─────────────────────────────────────┘
               ↕
┌─────────────────────────────────────┐
│     Physical Block Device           │
│     /dev/sdb (encrypted)            │
└─────────────────────────────────────┘

Creating Encrypted Pools

RHEL 9+ (Recommended Method):

# 1. Create encryption key
echo -n "MyVerySecurePassword123!" | sudo stratis key set --capture-key mykey

# 2. Verify key is stored
sudo stratis key list
# KEY NAME
# mykey

# 3. Create encrypted pool
sudo stratis pool create --key-desc mykey mypool_enc /dev/sdb

# 4. Verify encryption
stratis pool list
# mypool_enc   500 GiB   ~Ca,Cr  ← Cr indicates encryption

RHEL 8 (Alternative Method):

# Manual LUKS setup, then use with Stratis
sudo cryptsetup luksFormat /dev/sdb
sudo cryptsetup luksOpen /dev/sdb sdb_crypt
sudo stratis pool create mypool /dev/mapper/sdb_crypt

Key Management

Storing Keys:

Keys are stored in the kernel keyring (not on disk).

# Set key (in memory)
echo -n "password" | sudo stratis key set --capture-key mykey

# List keys
sudo stratis key list

# Reset key (change password)
echo -n "newpassword" | sudo stratis key reset --capture-key mykey

# Unset key (remove from memory)
sudo stratis key unset mykey

Key Storage Locations:

  1. Kernel Keyring (runtime, in-memory)

    • Keys stored during system operation
    • Lost on reboot
    • Accessed via stratis key commands
  2. Tang Server (network-based unlocking)

    • Automatic unlocking via network
    • Requires Clevis + Tang
    • For automated boots
  3. TPM 2.0 (hardware-based)

    • Keys stored in TPM chip
    • Automatic unlocking
    • Requires TPM 2.0 hardware

Unlocking Encrypted Pools

Manual Unlock at Boot:

# System boots, encrypted pools are locked
# Unlock manually:
sudo stratis key set --capture-key mykey
# Enter password when prompted

# Start pool
sudo stratis pool start mypool_enc

# Or unlock all pools
sudo stratis pool start --unlock-method=keyring

Automatic Unlock with Tang (NBDE):

Network-Bound Disk Encryption - automatic unlocking via network.

# 1. Install Clevis
sudo dnf install clevis-luks

# 2. Bind to Tang server
sudo stratis pool bind nbde \
  --trust-url \
  mypool_enc \
  '{"url":"http://tang.example.com:7500","thp":"HASH"}'

# 3. Verify binding
stratis pool list

# 4. On boot, pool unlocks automatically if Tang server is reachable

Automatic Unlock with TPM:

# Bind pool to TPM
sudo stratis pool bind tpm mypool_enc

# Pool will unlock automatically using TPM on boot

Encryption Best Practices

Key Management:

# Use strong passwords (20+ characters)
# Store master password in secure location (password manager)
# Use Tang/TPM for automatic unlocking in production
# Regularly test recovery procedures

Backup Encrypted Data:

# Encrypted pools require key for access
# Backup:
# 1. Data (encrypted)
# 2. Pool configuration
# 3. Encryption keys (secure location)

Testing Recovery:

# Simulate disaster recovery
# 1. Unset key
sudo stratis key unset mykey

# 2. Try to access pool (should fail)
stratis filesystem list mypool_enc

# 3. Restore key
echo -n "password" | sudo stratis key set --capture-key mykey

# 4. Unlock pool
sudo stratis pool start mypool_enc

Monitoring and Troubleshooting

Monitoring Pool Health

Basic Status:

# All pools
stratis pool list

# Specific pool details
stratis pool list mypool

# All block devices
stratis blockdev list

# Devices in specific pool
stratis blockdev list mypool

# All filesystems
stratis filesystem list

# Filesystems in specific pool
stratis filesystem list mypool

Detailed Pool Information:

# Pool usage statistics
stratis pool list
# NAME     TOTAL PHYSICAL   PROPERTIES
# mypool   1 TiB           ~Ca,~Cr

# Calculate actual usage
stratis filesystem list mypool
# Sum "Used" column for total consumption

# Available space = TOTAL PHYSICAL - Sum(Used)

Daemon Status:

# Check stratisd service
sudo systemctl status stratisd

# View logs
sudo journalctl -u stratisd

# Follow logs in real-time
sudo journalctl -u stratisd -f

# View recent errors
sudo journalctl -u stratisd -p err

Monitoring Commands

Watch Pool Usage:

# Real-time pool monitoring
watch -n 5 'stratis pool list && echo && stratis filesystem list'

Check Device Health:

# SMART monitoring (requires smartmontools)
sudo smartctl -a /dev/sdb

# Check device errors in kernel log
sudo dmesg | grep -i 'sdb\|error'

# Filesystem check (unmount first)
sudo umount /stratis/mypool/data
sudo xfs_repair -n /stratis/mypool/data  # -n = no modify, check only

Alerting and Notifications

systemd Journal Monitoring:

# Monitor for Stratis warnings
sudo journalctl -u stratisd -f | grep -i 'warn\|error\|crit'

Automated Alert Script:

#!/bin/bash
# /usr/local/bin/stratis-alert.sh

# Check for critical pool usage
POOLS=$(stratis pool list | awk 'NR>1 {print $1}')

for POOL in $POOLS; do
    # Get total physical size (in GiB)
    TOTAL=$(stratis pool list | grep "^$POOL" | awk '{print $2}' | sed 's/GiB//')

    # Get used space (sum of all filesystems)
    USED=$(stratis filesystem list $POOL | awk 'NR>1 {sum+=$3} END {print sum}' | sed 's/GiB//')

    # Calculate percentage
    if [ -n "$TOTAL" ] && [ -n "$USED" ]; then
        PERCENT=$(echo "scale=2; $USED / $TOTAL * 100" | bc)

        if (( $(echo "$PERCENT > 80" | bc -l) )); then
            echo "WARNING: Pool $POOL is ${PERCENT}% full"
            # Send alert (email, webhook, etc.)
            # mail -s "Stratis Alert" admin@example.com <<< "Pool $POOL is ${PERCENT}% full"
        fi
    fi
done

Systemd Timer for Monitoring:

Create /etc/systemd/system/stratis-monitor.timer:

[Unit]
Description=Stratis Pool Monitor Timer

[Timer]
OnBootSec=10min
OnUnitActiveSec=1h

[Install]
WantedBy=timers.target

Create /etc/systemd/system/stratis-monitor.service:

[Unit]
Description=Stratis Pool Monitor

[Service]
Type=oneshot
ExecStart=/usr/local/bin/stratis-alert.sh

Enable:

sudo systemctl enable --now stratis-monitor.timer

Performance Monitoring

I/O Statistics:

# Install sysstat if not present
sudo dnf install sysstat

# Monitor I/O for Stratis devices
iostat -x 5 | grep stratis

# Detailed per-device stats
iostat -xdm 5 /dev/mapper/stratis-*

Filesystem Performance:

# Test filesystem I/O
# Write test
dd if=/dev/zero of=/stratis/mypool/data/testfile bs=1G count=1 oflag=direct

# Read test
dd if=/stratis/mypool/data/testfile of=/dev/null bs=1M iflag=direct

# Cleanup
rm /stratis/mypool/data/testfile

Stratis vs LVM Comparison

Feature Comparison

Feature Stratis LVM
Ease of Use High (simple commands) Medium (complex, many commands)
Learning Curve Low (10 commands) High (30+ commands)
Thin Provisioning Default, automatic Manual setup required
Snapshots Simple (1 command) Complex (manual thin pool)
Filesystem Choice XFS only Any (ext4, XFS, etc.)
Encryption Integrated LUKS Manual setup
API D-Bus (programmatic) CLI only
Monitoring Built-in warnings Manual
Pool Expansion Simple (add-data) Medium (vgextend)
Filesystem Resize Automatic Manual (lvextend + resize2fs/xfs_growfs)
Cache Tier Simple (init-cache) Complex (lvmcache setup)
Maturity Newer (2018+) Mature (1998+)
Production Use RHEL 8.3+, RHEL 9/10 All Linux distros
Flexibility Lower (XFS only, fewer options) Higher (many options)
Automation Excellent (D-Bus API) Good (CLI scripting)
Device Removal Not supported Supported (pvmove)
RAID Not supported (use mdadm) Supported (LVM RAID)
Multi-path Works with dm-multipath Works with dm-multipath

Command Comparison

Creating Storage:

# Stratis (4 commands)
sudo stratis pool create mypool /dev/sdb
sudo stratis filesystem create mypool data
sudo mount /stratis/mypool/data /data
echo '/stratis/mypool/data /data xfs defaults 0 0' >> /etc/fstab

# LVM (7 commands)
sudo pvcreate /dev/sdb
sudo vgcreate vg_data /dev/sdb
sudo lvcreate -L 100G -n lv_data vg_data
sudo mkfs.xfs /dev/vg_data/lv_data
sudo mount /dev/vg_data/lv_data /data
echo '/dev/vg_data/lv_data /data xfs defaults 0 0' >> /etc/fstab

Creating Snapshots:

# Stratis (1 command)
sudo stratis filesystem snapshot mypool data data_snap

# LVM with Thin Provisioning (3-5 commands)
# (Assuming thin pool already set up)
sudo lvcreate -s -n lv_data_snap /dev/vg_data/lv_data
# (If no thin pool, add 3+ commands to set up thin provisioning first)

Expanding Storage:

# Stratis (2 commands)
sudo stratis pool add-data mypool /dev/sdc
# Filesystems grow automatically

# LVM (3 commands)
sudo vgextend vg_data /dev/sdc
sudo lvextend -L +100G /dev/vg_data/lv_data
sudo xfs_growfs /data

Use Case Recommendations

Use Stratis When:

  • Simplicity is priority
  • XFS filesystem is acceptable
  • RHEL 8.3+, RHEL 9/10, or Fedora
  • Need easy snapshots
  • Prefer automated thin provisioning
  • Want integrated encryption
  • Building new infrastructure
  • Prefer modern tools

Use LVM When:

  • Need filesystem flexibility (ext4, Btrfs, etc.)
  • Require device removal capability
  • Need LVM RAID
  • Using older distributions
  • Require specific LVM features (caching specifics, etc.)
  • Have existing LVM infrastructure
  • Need maximum control and flexibility
  • Working with non-RHEL/Fedora distros

Use Both:

  • Stratis for application data (simple management)
  • LVM for system volumes (flexibility, compatibility)

When to Use Stratis

Ideal Use Cases

1. Application Data Storage

# Web application data
sudo stratis pool create app_pool /dev/sdb /dev/sdc
sudo stratis filesystem create app_pool webdata
sudo mount /stratis/app_pool/webdata /var/www

# Database storage
sudo stratis filesystem create app_pool database
sudo mount /stratis/app_pool/database /var/lib/mysql

2. Development Environments

# Easy snapshot-based testing
sudo stratis pool create dev_pool /dev/sdb
sudo stratis filesystem create dev_pool project

# Before major change
sudo stratis filesystem snapshot dev_pool project project_backup

# If change fails, restore from snapshot

3. User Home Directories

# Flexible, expandable user storage
sudo stratis pool create home_pool /dev/sdb /dev/sdc
sudo stratis filesystem create home_pool homes
sudo mount /stratis/home_pool/homes /home

4. Container Storage

# Docker/Podman volumes
sudo stratis pool create container_pool /dev/sdb
sudo stratis filesystem create container_pool docker_data
sudo mount /stratis/container_pool/docker_data /var/lib/docker

5. Backup Targets

# Snapshot-based backups
sudo stratis pool create backup_pool /dev/sdb /dev/sdc /dev/sdd
sudo stratis filesystem create backup_pool backups
sudo mount /stratis/backup_pool/backups /backups

6. Virtual Machine Storage

# VM image storage
sudo stratis pool create vm_pool /dev/sdb /dev/sdc
sudo stratis filesystem create vm_pool images
sudo mount /stratis/vm_pool/images /var/lib/libvirt/images

Not Recommended For

1. Boot/Root Filesystems

  • Stratis not bootable (chicken-and-egg: needs running stratisd)
  • Use LVM or standard partitions for /boot, /

2. High-Performance Databases (without cache tier)

  • XFS might not be optimal for all database workloads
  • Consider dedicated storage for performance-critical DBs

3. Systems Requiring ext4

  • Stratis is XFS-only
  • If you need ext4, use LVM

4. Distributions Without Stratis

  • Not available on Ubuntu, Debian, etc. (yet)
  • RHEL/Fedora/CentOS Stream only

systemd Integration

Automatic Pool Start

Stratis pools are automatically started by stratisd.service at boot.

Check Service:

sudo systemctl status stratisd
# ● stratisd.service - Stratis daemon
#    Loaded: loaded (/usr/lib/systemd/system/stratisd.service; enabled)
#    Active: active (running)

Enable at Boot (should be default):

sudo systemctl enable stratisd

Mounting Filesystems at Boot

Method 1: /etc/fstab (Traditional)

# Add to /etc/fstab
/stratis/mypool/data    /data    xfs    defaults    0 0

Important: Ensure stratisd.service is started before mount:

# /etc/fstab with dependency (recommended)
/stratis/mypool/data    /data    xfs    defaults,x-systemd.requires=stratisd.service    0 0

Method 2: systemd Mount Units (Recommended)

Create /etc/systemd/system/data.mount:

[Unit]
Description=Mount Stratis Filesystem for Application Data
Documentation=man:stratis(8)
Requires=stratisd.service
After=stratisd.service

[Mount]
What=/stratis/mypool/data
Where=/data
Type=xfs
Options=defaults

[Install]
WantedBy=local-fs.target

Enable:

sudo systemctl enable data.mount
sudo systemctl start data.mount

Verify:

systemctl status data.mount

Handling Encrypted Pools at Boot

Problem: Encrypted pools require key before mounting.

Solution 1: Manual Unlock

# Boot to emergency shell or login
# Provide key:
sudo stratis key set --capture-key mykey
# Enter password

# Start pool
sudo stratis pool start mypool_enc

# Mount filesystems
sudo systemctl start data.mount

Solution 2: Tang Network Unlock (NBDE)

Automatically unlocks encrypted pool via network.

# Setup (one-time)
sudo stratis pool bind nbde \
  --trust-url \
  mypool_enc \
  '{"url":"http://tang.example.com:7500"}'

# Reboot - pool unlocks automatically if Tang server reachable

Solution 3: TPM Unlock

# Bind to TPM
sudo stratis pool bind tpm mypool_enc

# Reboot - pool unlocks automatically using TPM

systemd Service Dependencies

Ensure Proper Startup Order:

For applications that depend on Stratis filesystems:

Create /etc/systemd/system/myapp.service.d/override.conf:

[Unit]
RequiresMountsFor=/stratis/mypool/data
After=data.mount

Or directly in service:

[Unit]
Description=My Application
After=data.mount
Requires=data.mount

[Service]
ExecStart=/usr/bin/myapp
WorkingDirectory=/stratis/mypool/data

[Install]
WantedBy=multi-user.target

Emergency Recovery

Boot to Emergency Mode:

# At GRUB, add to kernel command line:
systemd.unit=emergency.target

# Once in emergency shell:
# 1. Start stratisd
systemctl start stratisd

# 2. Unlock encrypted pools (if needed)
stratis key set --capture-key mykey

# 3. Start pools
stratis pool start mypool

# 4. Mount filesystems
mount /stratis/mypool/data /data

# 5. Continue boot
systemctl default

Best Practices

Design and Planning

1. Pool Design

# Good: Dedicated pools for different workloads
sudo stratis pool create app_pool /dev/sdb /dev/sdc      # Application data
sudo stratis pool create db_pool /dev/sdd /dev/sde       # Database
sudo stratis pool create backup_pool /dev/sdf /dev/sdg   # Backups

# Avoid: Single pool for everything (limits flexibility)

2. Device Selection

# Use whole disks, not partitions (when possible)
sudo stratis pool create mypool /dev/sdb  # Good

# Avoid partitions unless necessary
sudo stratis pool create mypool /dev/sdb1  # Works, but less flexible

3. Overprovisioning Strategy

# Conservative: 2:1 ratio (2 TB virtual, 1 TB physical)
# Moderate: 3:1 ratio (common for general use)
# Aggressive: 5:1+ ratio (only if usage patterns well-known)

# Monitor and adjust based on actual usage

Operational Best Practices

1. Monitoring

# Set up automated monitoring (cron or systemd timer)
0 * * * * /usr/local/bin/stratis-monitor.sh

# Alert at 80% pool usage
# Critical alert at 90%

2. Snapshot Strategy

# Pre-change snapshots
sudo stratis filesystem snapshot mypool data data_pre_upgrade_$(date +%Y%m%d)

# Regular snapshots (automated)
# Daily: Keep 7 days
# Weekly: Keep 4 weeks
# Monthly: Keep 12 months

3. Expansion Planning

# Keep spare devices ready for expansion
# Add when pool reaches 70-80% usage

sudo stratis pool add-data mypool /dev/sdh

4. Documentation

# Document pool layout
# /etc/stratis/pools.txt:
# mypool: /dev/sdb, /dev/sdc (1TB total, app data)
# db_pool: /dev/sdd, /dev/sde (2TB total, PostgreSQL)

# Document filesystems
# /etc/stratis/filesystems.txt:
# mypool/app1 -> /var/www/app1
# mypool/logs -> /var/log/app

Backup and Recovery

1. Backup Strategy

# Snapshot before backup
sudo stratis filesystem snapshot mypool data data_backup

# Backup from snapshot (consistent state)
sudo rsync -avxHAX /stratis/mypool/data_backup/ /backups/data/

# Destroy snapshot after backup
sudo stratis filesystem destroy mypool data_backup

2. Disaster Recovery Plan

# Document:
# 1. Pool names and device mappings
# 2. Filesystem names and mount points
# 3. Encryption keys (secure location)
# 4. Recovery procedures

# Test recovery quarterly

3. Configuration Backup

# Backup Stratis metadata (included in device)
# But document configuration separately:

# Pool configuration
stratis pool list > /etc/stratis/pool_config.txt
stratis blockdev list >> /etc/stratis/pool_config.txt

# Filesystem configuration
stratis filesystem list > /etc/stratis/fs_config.txt

# fstab entries
grep stratis /etc/fstab > /etc/stratis/fstab_entries.txt

# Store in version control or backup

Security Best Practices

1. Encryption

# Encrypt sensitive data pools
sudo stratis pool create --key-desc sensitive_key \
  sensitive_pool /dev/sdb

# Use strong passwords (20+ characters)
# Store keys securely (password manager, vault)

2. Access Control

# Restrict mount point permissions
sudo chmod 750 /stratis/mypool/sensitive
sudo chown app:app /stratis/mypool/sensitive

# Use SELinux contexts
sudo semanage fcontext -a -t httpd_sys_content_t "/stratis/mypool/web(/.*)?"
sudo restorecon -Rv /stratis/mypool/web

Performance Best Practices

1. Cache Tier for Mixed Workloads

# Use SSD cache for HDD pools
sudo stratis pool create app_pool /dev/sdb /dev/sdc  # HDDs
sudo stratis pool init-cache app_pool /dev/nvme0n1   # SSD cache

2. XFS Tuning

# Mount options for specific workloads
# Large files (video, backups):
/stratis/mypool/data /data xfs defaults,largeio,inode64 0 0

# Many small files (maildir):
/stratis/mypool/mail /mail xfs defaults,logbufs=8 0 0

3. Avoid Fragmentation

# Regular defragmentation for heavily modified filesystems
sudo xfs_fsr /stratis/mypool/data

# Or schedule via cron:
# 0 3 * * 0 xfs_fsr /stratis/mypool/data

RHEL 9/10 Specific Features

RHEL 9 Enhancements

1. Enhanced Encryption (LUKS2)

# RHEL 9 uses LUKS2 by default (better than LUKS1)
echo -n "password" | sudo stratis key set --capture-key mykey
sudo stratis pool create --key-desc mykey mypool_enc /dev/sdb

# LUKS2 benefits:
# - Better metadata protection
# - Supports multiple keys
# - Better performance
# - More flexible unlocking methods

2. Improved Monitoring

# Better daemon logging
sudo journalctl -u stratisd --since "1 hour ago"

# Enhanced D-Bus introspection
busctl tree org.storage.stratis3

3. systemd Integration

# Improved boot-time handling
# Automatic pool detection
# Better dependency management with systemd mount units

4. Clevis Integration (NBDE)

# Easier Tang-based unlocking
sudo dnf install clevis-luks stratisd-dracut

# Bind encrypted pool to Tang server
sudo stratis pool bind nbde \
  --trust-url \
  mypool_enc \
  '{"url":"http://tang.example.com:7500"}'

# Automatic unlock at boot (if Tang reachable)

RHEL 10 Features

1. Performance Improvements

  • Faster daemon startup
  • Optimized thin provisioning
  • Better cache tier performance

2. Enhanced API

# Improved D-Bus API version (stratis3)
# Better programmatic access
# More detailed status information

3. Better Error Handling

# More descriptive error messages
# Improved recovery from failures
# Better pool health detection

4. Modernized Tools

# Updated stratis-cli (Python 3.9+)
# Better output formatting
# Improved scripting support

Version Checking

# Check RHEL version
cat /etc/redhat-release

# Check Stratis version
stratis --version
stratis daemon version

# Check available features
rpm -q stratisd stratis-cli

Migration from RHEL 8 to RHEL 9

Stratis pools are compatible across RHEL 8/9/10.

# 1. Backup all data
sudo rsync -avxHAX /stratis/mypool/ /backup/

# 2. Export pool configuration
stratis pool list > /root/stratis_pools.txt
stratis filesystem list > /root/stratis_fs.txt

# 3. Perform RHEL upgrade (in-place or migrate)
sudo dnf upgrade

# 4. Verify Stratis after upgrade
sudo systemctl status stratisd
stratis pool list
stratis filesystem list

# 5. Verify all mounts
mount | grep stratis

No Stratis-specific migration needed - pools work across versions.


Troubleshooting Guide

Common Issues

Issue 1: Pool Won't Start

Symptoms:

stratis pool list
# Empty output, no pools shown

Diagnosis:

# Check daemon status
sudo systemctl status stratisd

# Check logs
sudo journalctl -u stratisd -n 50

# Check if devices are visible
lsblk

Solutions:

# 1. Restart daemon
sudo systemctl restart stratisd

# 2. Force pool start (if encrypted)
sudo stratis key set --capture-key mykey
sudo stratis pool start mypool

# 3. Check for device conflicts
sudo dmsetup ls | grep stratis

# 4. Clear stale device mapper devices
sudo dmsetup remove /dev/mapper/stratis-*-*
sudo systemctl restart stratisd

Issue 2: Filesystem Won't Mount

Symptoms:

sudo mount /stratis/mypool/data /data
mount: /data: special device /stratis/mypool/data does not exist

Diagnosis:

# Check if pool is started
stratis pool list

# Check if filesystem exists
stratis filesystem list

# Check symlink
ls -la /stratis/mypool/

# Check device mapper
ls -la /dev/mapper/stratis*

Solutions:

# 1. Ensure pool is started
sudo systemctl restart stratisd
stratis pool list

# 2. Use device mapper path directly
sudo mount /dev/mapper/stratis-XXXX-YYYY /data

# 3. Recreate symlink (if missing)
# (stratisd should do this automatically)
sudo systemctl restart stratisd

Issue 3: Pool Full / Out of Space

Symptoms:

# Applications report "disk full"
# df shows space, but writes fail

Diagnosis:

# Check pool physical usage
stratis pool list
# mypool   1 TiB   ~Ca,~Cr

# Check filesystem usage
stratis filesystem list mypool
# Sum "Used" column

# Check XFS filesystem
df -h /stratis/mypool/data

Solutions:

# 1. Add more physical devices
sudo stratis pool add-data mypool /dev/sdd

# 2. Delete unused snapshots
stratis filesystem list mypool
sudo stratis filesystem destroy mypool old_snapshot

# 3. Remove unnecessary files
# Clean up /stratis/mypool/data

# 4. Migrate to larger pool
# (create new pool, copy data, switch)

Issue 4: Encrypted Pool Won't Unlock

Symptoms:

stratis pool list
# Empty (encrypted pool not shown)

Diagnosis:

# Check if key is set
sudo stratis key list

# Check daemon logs
sudo journalctl -u stratisd | grep -i encrypt

Solutions:

# 1. Set key
echo -n "password" | sudo stratis key set --capture-key mykey

# 2. Start pool with unlock
sudo stratis pool start --unlock-method=keyring

# 3. If password forgotten
# (No recovery - data is permanently inaccessible)
# (This is encryption working as designed)

Issue 5: Daemon Won't Start

Symptoms:

sudo systemctl start stratisd
# Job for stratisd.service failed

Diagnosis:

# Check status
sudo systemctl status stratisd

# Check logs
sudo journalctl -u stratisd -xe

# Check for port/socket conflicts
sudo lsof -i :XXXX  # If D-Bus conflict

Solutions:

# 1. Check for existing daemon
sudo pkill stratisd
sudo systemctl start stratisd

# 2. Remove stale sockets
sudo rm -f /var/run/stratisd.sock
sudo systemctl start stratisd

# 3. Check SELinux denials
sudo ausearch -m avc -ts recent | grep stratisd
# If denials found:
sudo setenforce 0  # Temporarily
sudo systemctl start stratisd
# Then fix SELinux policy

# 4. Reinstall
sudo dnf reinstall stratisd
sudo systemctl start stratisd

Diagnostic Commands

Health Check Script:

#!/bin/bash
# /usr/local/bin/stratis-health-check.sh

echo "=== Stratis Health Check ==="

echo "1. Daemon Status:"
systemctl is-active stratisd

echo "2. Daemon Version:"
stratis daemon version

echo "3. Pools:"
stratis pool list

echo "4. Filesystems:"
stratis filesystem list

echo "5. Block Devices:"
stratis blockdev list

echo "6. Recent Errors:"
journalctl -u stratisd -p err --since "24 hours ago" --no-pager

echo "7. Device Mapper:"
dmsetup ls --tree | grep stratis

echo "=== Health Check Complete ==="

Recovery Procedures

Recover from Failed Device:

# If a device fails in multi-device pool:

# 1. Check pool status
stratis pool list

# 2. Check logs for device errors
sudo journalctl -u stratisd | grep -i error

# 3. Replace failed device (hardware replacement)
# (Stratis does not support RAID, so data may be lost)

# 4. Restore from backup
sudo rsync -avxHAX /backup/mypool/ /stratis/mypool/

Recover Pool Metadata:

# Stratis metadata is on devices
# If pool won't start but devices are intact:

# 1. Try forcing daemon restart
sudo systemctl restart stratisd

# 2. Check if devices are detected
lsblk

# 3. Pool should auto-detect
stratis pool list

# 4. If still not detected, check logs
sudo journalctl -u stratisd -n 100

Getting Help

Information to Collect:

# System info
uname -a
cat /etc/redhat-release

# Stratis versions
stratis --version
stratis daemon version
rpm -q stratisd stratis-cli

# Configuration
stratis pool list
stratis filesystem list
stratis blockdev list

# Logs
sudo journalctl -u stratisd --since "1 hour ago" > stratis.log

# Device info
lsblk -f > devices.txt

Where to Get Help:


Interview Questions

Basic Level

Q1: What is Stratis?

A: Stratis is a modern local storage management solution for Linux that
simplifies storage administration. It provides a unified interface for
pool-based storage, thin provisioning, snapshots, and encryption, using
existing technologies (XFS, device-mapper, LUKS) behind a simple API.

Q2: How does Stratis differ from LVM?

A: Main differences:
- Simplicity: Stratis has simpler commands (stratis pool/filesystem vs. pv/vg/lv)
- Thin provisioning: Automatic in Stratis, manual in LVM
- Filesystem: Stratis is XFS-only, LVM supports any filesystem
- API: Stratis has D-Bus API, LVM is CLI-only
- Snapshots: Simpler in Stratis (1 command vs. complex LVM thin setup)

Q3: What Linux distributions support Stratis?

A: Stratis is officially supported on:
- RHEL 8.3+ (fully supported)
- RHEL 9/10
- Fedora 28+
- CentOS Stream 8/9

Q4: What is a Stratis pool?

A: A pool is a collection of one or more block devices managed as a single
storage unit. Pools provide capacity for creating thinly-provisioned XFS
filesystems.

Q5: Can you resize Stratis filesystems?

A: Stratis filesystems don't need manual resizing. They are thinly
provisioned and automatically use available pool space as needed. When you
add devices to a pool, all filesystems automatically see more space.

Intermediate Level

Q6: Explain thin provisioning in Stratis.

A: Thin provisioning means filesystems are allocated virtual space that
appears larger than physical storage. Actual blocks are allocated only when
data is written. Benefits:
- Efficient space utilization
- Overprovisioning possible (more virtual than physical)
- Easy snapshots (shared blocks)
Risks:
- Pool can run out of space if overprovisioned
- Requires monitoring

Q7: How do you create an encrypted Stratis pool?

A: Steps:
1. Create encryption key:
   echo -n "password" | sudo stratis key set --capture-key mykey
2. Create encrypted pool:
   sudo stratis pool create --key-desc mykey mypool_enc /dev/sdb
3. Verify:
   stratis pool list  # Shows "Cr" property for encrypted

Encryption uses LUKS at block device level.

Q8: How do Stratis snapshots work?

A: Stratis snapshots are:
- Point-in-time copies of a filesystem
- Created instantly (copy-on-write via dm-thin)
- Fully writable
- Independent filesystems after creation
- Share blocks with parent until modified

Creation: stratis filesystem snapshot mypool data data_snap
Result: New filesystem at /stratis/mypool/data_snap

Q9: What happens if a Stratis pool runs out of space?

A: When physical space exhausted:
- Applications get "disk full" errors
- Filesystem I/O may pause or fail
- stratisd logs warnings

Solutions:
- Add more devices: stratis pool add-data mypool /dev/sdd
- Remove snapshots: stratis filesystem destroy mypool old_snap
- Delete unnecessary files
- Monitor pool usage proactively (80% threshold recommended)

Q10: How do you add storage to a Stratis pool?

A: Use the add-data command:
sudo stratis pool add-data mypool /dev/sdd

Effects:
- Pool capacity increases immediately
- All filesystems see additional space automatically
- No filesystem resize needed (thin provisioning)
- Devices are added to the pool's data tier

Advanced Level

Q11: Explain the Stratis architecture layers.

A: Stratis architecture (bottom to top):
1. Block Device Layer: Physical disks (/dev/sdb, etc.)
2. Optional LUKS: Encryption layer (dm-crypt)
3. Device Mapper Thin Pool: Thin provisioning engine (dm-thin)
   - Metadata device (pool metadata)
   - Data device (actual storage)
4. Stratis Service Layer: stratisd daemon
   - Pool management
   - D-Bus API
   - Monitoring
5. Filesystem Layer: XFS filesystems (thin volumes)
6. Application Layer: Files accessed via mount points

Data flow: Application -> XFS -> dm-thin -> LUKS (optional) -> Block Device

Q12: How does Stratis integrate with systemd?

A: Integration points:
1. Service: stratisd.service manages daemon
2. Automatic start: Pools detected and started at boot
3. Mount units: Recommended for filesystem mounting
   - Declare dependencies (Requires=stratisd.service)
   - Ensure proper startup order (After=stratisd.service)
4. Encrypted pools: Can integrate with Tang (NBDE) for automatic unlock
5. Logs: Journal integration (journalctl -u stratisd)

Example mount unit:
[Unit]
Requires=stratisd.service
After=stratisd.service

[Mount]
What=/stratis/mypool/data
Where=/data
Type=xfs

Q13: What is the cache tier feature in Stratis?

A: Cache tier uses fast devices (SSD) to cache data from slower devices (HDD).

Setup:
1. Create pool with data devices (HDDs):
   stratis pool create mypool /dev/sdb /dev/sdc
2. Add cache tier (SSD):
   stratis pool init-cache mypool /dev/nvme0n1

Behavior:
- Automatic block-level caching
- Write-through (data written to HDD immediately)
- Read caching for performance
- Managed by dm-cache

Benefits:
- Performance improvement for mixed workloads
- Transparent to applications
- No manual management needed

Q14: How do you implement disaster recovery for Stratis?

A: DR strategy:
1. Documentation:
   - Pool names and device mappings
   - Filesystem names and mount points
   - Encryption keys (secure location)

2. Regular backups:
   - Snapshot before backup (consistent state)
   - rsync data to backup location
   - Store configuration separately

3. Encryption key backup:
   - Store passwords in secure vault
   - Document key names and purposes
   - Test recovery procedures

4. Recovery procedure:
   - Recreate pool with new devices
   - Restore data from backups
   - Reconfigure mounts and applications

5. Testing:
   - Quarterly DR drills
   - Document recovery time
   - Update procedures as needed

Q15: Compare Stratis to ZFS and Btrfs.

A: Comparison:

Stratis vs ZFS:
- ZFS: Integrated filesystem+volume manager (monolithic)
- Stratis: Uses existing Linux components (XFS, dm)
- ZFS: More features (compression, dedup, RAID-Z)
- Stratis: Simpler, more focused
- ZFS: Licensing issues on Linux
- Stratis: Native Linux, RHEL-supported

Stratis vs Btrfs:
- Btrfs: Integrated filesystem with snapshots, RAID
- Stratis: Separate volume manager + XFS
- Btrfs: More flexible (subvolumes, compression)
- Stratis: More stable (uses mature XFS)
- Btrfs: Native snapshots
- Stratis: Snapshots via thin provisioning

Stratis philosophy: Use proven technologies (XFS, dm) with simple interface
ZFS/Btrfs philosophy: Integrated solution with all features built-in

Q16: How would you monitor Stratis in production?

A: Production monitoring approach:

1. Real-time monitoring:
   - systemd journal: journalctl -u stratisd -f
   - Built-in warnings (80%, 90% full)

2. Automated checks (hourly):
   - Pool usage: stratis pool list
   - Filesystem usage: stratis filesystem list
   - Calculate overprovision ratio
   - Alert if >80% physical usage

3. Health checks (daily):
   - Daemon status: systemctl status stratisd
   - Device health: smartctl -a /dev/sdX
   - Filesystem integrity: xfs_repair -n (offline)

4. Metrics collection:
   - Export to monitoring system (Prometheus, Grafana)
   - D-Bus API for programmatic access
   - Custom scripts for aggregation

5. Alerting:
   - Email/Slack for critical events
   - PagerDuty for pool >90% full
   - Dashboard for visual monitoring

Automation: systemd timers for scheduled checks

Q17: Explain how to migrate from LVM to Stratis.

A: Migration strategy (no in-place conversion available):

1. Preparation:
   - Inventory LVM configuration (pvs, vgs, lvs)
   - Document mount points and dependencies
   - Plan downtime window

2. Create Stratis infrastructure:
   - Provision new devices for Stratis pool
   - Create pool: stratis pool create newpool /dev/sdX
   - Create filesystems: stratis filesystem create newpool data

3. Data migration:
   - Mount Stratis filesystems
   - Copy data: rsync -avxHAX /old/lvm/mount/ /stratis/newpool/data/
   - Verify data integrity (checksums)

4. Cutover:
   - Stop applications
   - Final sync (incremental)
   - Update /etc/fstab (Stratis paths)
   - Update application configs
   - Start applications on Stratis

5. Cleanup:
   - Verify for 1-2 weeks
   - Destroy LVM volumes (lvremove)
   - Remove volume groups (vgremove)
   - Repurpose devices

Risk mitigation: Parallel run both systems, gradual migration per filesystem

Q18: How does Stratis handle device failure?

A: Device failure handling:

Important: Stratis does NOT provide RAID/redundancy by default.

Single device pool:
- Device failure = data loss
- No recovery mechanism
- Must restore from backup

Multi-device pool (no redundancy):
- Device failure = data loss
- Stratis spans data across devices (like RAID 0)
- No built-in redundancy

Mitigation strategies:
1. Use hardware RAID below Stratis
2. Use mdadm RAID, then create Stratis pool on /dev/mdX
3. Application-level replication
4. Regular backups with snapshots

Detection:
- stratisd logs device errors
- Pool may fail to start
- I/O errors in journal

Recovery:
- No automatic recovery
- Restore from backup
- Recreate pool with new device

Future: Device redundancy may be added in future Stratis versions

Q19: What are the limitations of Stratis?

A: Current limitations:

1. Filesystem: XFS only (no ext4, Btrfs choice)
2. No RAID: No built-in redundancy (use mdadm or hardware RAID)
3. No device removal: Cannot remove devices from pool
4. Distribution support: RHEL/Fedora/CentOS only
5. Not bootable: Cannot use for /boot or root filesystem
6. No compression: No built-in compression (unlike ZFS/Btrfs)
7. No deduplication: No built-in dedup
8. No send/receive: No ZFS-like send/receive for replication
9. Maturity: Relatively new (2018) vs. LVM (1998)
10. Migration: No in-place conversion from LVM

Design choices (not bugs):
- Simplicity over features
- Use existing Linux tech
- Focus on ease of use

Workarounds:
- RAID: Use mdadm below Stratis
- Compression: Use filesystem-level tools
- Replication: Use rsync, application-level tools

Q20: How would you design a Stratis-based storage architecture for a web application?

A: Web application storage design:

Infrastructure:
- App servers: 3+ for HA
- Storage: Shared or local, depending on architecture

Option A: Local Stratis (scale-out):
1. Each app server has local Stratis pool
2. Application handles replication (database cluster, distributed cache)
3. Fast local I/O
4. Easier failover (no shared storage dependency)

Setup:
- App server 1: stratis pool create app_pool /dev/sdb /dev/sdc
  - Filesystem: web_content, logs, cache
- App server 2: Same configuration
- App server 3: Same configuration

Option B: Shared storage (scale-up):
1. SAN/iSCSI/FC storage presented to app servers
2. Shared Stratis pool (NOT supported - use local pools)
3. Alternative: Stratis on each node with app-level replication

Recommended design:
1. Pools:
   - web_pool: Web content (/var/www)
   - db_pool: Database (/var/lib/mysql)
   - log_pool: Logs (/var/log/app)
   - cache_pool: Application cache

2. Features:
   - Encryption: For sensitive data pools
   - Snapshots: Pre-deployment snapshots
   - Cache tier: SSD cache for db_pool

3. Monitoring:
   - Automated pool usage alerts
   - Daily snapshots
   - Weekly backups

4. Backup strategy:
   - Snapshot before backup
   - rsync to backup storage
   - Off-site replication

5. DR:
   - Documented pool configuration
   - Encryption keys in vault
   - Quarterly DR drills

Summary

Stratis is a modern, user-friendly storage management solution for Linux that simplifies complex storage tasks. It is ideal for RHEL/Fedora environments where simplicity, thin provisioning, and easy snapshots are priorities. While it has limitations (XFS-only, no built-in RAID), it excels at making storage management accessible and automated.

Key Takeaways:

  • Use Stratis for simplified storage management on RHEL 8.3+, RHEL 9/10, Fedora
  • All filesystems are thinly provisioned XFS by default
  • Snapshots are instant and easy to create
  • Encryption is integrated (LUKS)
  • Monitor pool usage to prevent overprovision issues
  • Use LVM when you need more flexibility or non-XFS filesystems
  • Plan for DR with backups and documentation
  • Integrate with systemd for proper boot-time handling

Quick Reference:

# Create pool
stratis pool create mypool /dev/sdb

# Create filesystem
stratis filesystem create mypool data

# Mount
mount /stratis/mypool/data /data

# Snapshot
stratis filesystem snapshot mypool data data_snap

# Expand pool
stratis pool add-data mypool /dev/sdc

# Monitor
stratis pool list
stratis filesystem list

For production use, combine Stratis with proper monitoring, backup strategies, and documentation for a robust storage solution.