Straits docs
π₯οΈ Stratis Storage Management Tutorial π₯οΈ
π Table of Contents π
- What is Stratis?
- Why Do We Need Stratis?
- Installing Stratis
- Creating and Managing Stratis Pools
- 4.1 Create Stratis Pool
- 4.2 Create File System in Stratis
- 4.3 Mount File System
- 4.4 Extend Stratis Pool
- 4.5 Take a Snapshot
- Common Stratis Commands
- Practical Stratis Script
- Summary
1οΈβ£ What is Stratis?
Stratis is a storage management solution designed to simplify the process of managing storage pools and file systems on Linux. It combines features from LVM and ZFS while offering a more straightforward interface. Stratis allows you to manage pools made from different storage devices and provides features like:
- Thin provisioning π: Allocate space dynamically.
- Snapshots πΈ: Quickly save the state of a file system.
- Tiered Storage ποΈ: Combine SSDs and HDDs for optimal performance.
2οΈβ£ Why Do We Need Stratis?
Stratis makes advanced storage management tasks easy to perform. You need Stratis when you:
- Manage multiple storage devices.
- Require easy-to-use snapshots.
- Want to expand storage dynamically without manual partition resizing.
- Need a user-friendly alternative to LVM or ZFS.
3οΈβ£ Installing Stratis
Before using Stratis, ensure it's installed and the service is running.
# Install Stratis on CentOS/RHEL
sudo yum install -y stratisd stratis-cli
# Start and enable Stratis service
sudo systemctl start stratisd
sudo systemctl enable stratisd
4οΈβ£ Creating and Managing Stratis Pools
4.1 Create Stratis Pool
To create a Stratis pool, you must specify one or more storage devices. In this example, we will create a pool called mystorage
using /dev/sdb
and /dev/sdc
.
4.2 Create File System in Stratis
After creating the pool, you can create a file system within the pool. Letβs create a file system named mystoragefs
.
4.3 Mount File System
To use the file system, you need to mount it to a directory. We will mount mystoragefs
to /mnt/mystorage
.
# Create the mount point
sudo mkdir -p /mnt/mystorage
# Mount the Stratis file system
sudo mount /stratis/mystorage/mystoragefs /mnt/mystorage
4.4 Extend Stratis Pool
To add more storage to an existing Stratis pool, simply add another disk to the pool.
4.5 Take a Snapshot
Snapshots are useful for backups or creating test environments. Hereβs how to take a snapshot of the mystoragefs
file system.
# Create a snapshot named 'snapshot1'
sudo stratis filesystem snapshot mystorage mystoragefs snapshot1
5οΈβ£ Common Stratis Commands
Command | Description |
---|---|
stratis pool create |
Create a new Stratis storage pool. |
stratis filesystem create |
Create a file system within a pool. |
stratis filesystem snapshot |
Create a snapshot of a file system. |
stratis pool add-data |
Add a device to an existing pool. |
stratis filesystem list |
List file systems in a Stratis pool. |
stratis pool list |
List all Stratis pools. |
stratis pool destroy |
Destroy a Stratis pool and all its file systems. |
stratis filesystem destroy |
Destroy a file system in a pool. |
6οΈβ£ Practical Stratis Script
Hereβs a script demonstrating the steps to create a pool, file system, and snapshot using Stratis.
#!/bin/bash
# Stage 1: Install Stratis if not installed
echo "π Installing Stratis..."
sudo yum install -y stratisd stratis-cli
# Stage 2: Start and enable Stratis daemon
echo "π Starting Stratis daemon..."
sudo systemctl start stratisd
sudo systemctl enable stratisd
# Stage 3: Create a Stratis pool using /dev/sdb and /dev/sdc
echo "πΎ Creating Stratis pool 'mystorage'..."
sudo stratis pool create mystorage /dev/sdb /dev/sdc
# Stage 4: Create a file system in the pool
echo "π Creating file system 'mystoragefs'..."
sudo stratis filesystem create mystorage mystoragefs
# Stage 5: Create a mount point and mount the file system
echo "π Mounting file system to /mnt/mystorage..."
sudo mkdir -p /mnt/mystorage
sudo mount /stratis/mystorage/mystoragefs /mnt/mystorage
# Stage 6: Take a snapshot of the file system
echo "πΈ Taking a snapshot of the file system..."
sudo stratis filesystem snapshot mystorage mystoragefs snapshot1
echo "β
Stratis setup completed successfully!"
7οΈβ£ Summary
Stratis offers a powerful, user-friendly approach to managing storage pools and file systems on Linux systems. With features like thin provisioning, snapshots, and tiered storage, Stratis simplifies complex storage tasks. Whether you're managing multiple disks or taking snapshots for backups, Stratis provides a flexible, efficient solution for system administrators.
By following this tutorial, youβve learned how to:
- Install Stratis and start the daemon.
- Create and extend Stratis pools.
- Manage file systems and snapshots using practical commands.