Bookmark this page

Guided Exercise: Configuring Storage with Stratis

Set up and manage complex storage configurations integrated by the Stratis high-level system.

Outcomes

You should be able to install and configure file systems with the Stratis service.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command confirms that the required hosts for this exercise are accessible and have the required devices for the file system configuration.

[student@workstation ~]$ lab start storage-overview

Instructions

  1. Log in to servera and switch to the root user.

    [student@workstation ~]$ ssh student@servera
    ...output omitted...
    [student@servera ~]$ sudo -i
    [sudo] password for student: student
    [root@servera ~]#
  2. Install and enable the Stratis service.

    1. Install the stratisd and stratis-cli packages.

      [root@servera ~]# yum install stratisd stratis-cli
    2. Ensure that the stratisd service is enabled.

      [root@servera ~]# systemctl enable --now stratisd
  3. Create a Stratis pool named my-pool that consists of the /dev/vdb and /dev/vdc devices.

    1. Wipe devices from any file system, partition table, or RAID signatures.

      [root@servera ~]# wipefs --all /dev/vdb /dev/vdc
    2. Create a Stratis pool.

      [root@servera ~]# stratis pool create my-pool /dev/vdb /dev/vdc
    3. Verify the Stratis pool.

      [root@servera ~]# stratis blockdev
      Pool Name   Device Node   Physical Size   Tier
      my-pool     /dev/vdb              1 GiB   Data
      my-pool     /dev/vdc              1 GiB   Data
      [root@servera ~]# stratis pool list
      Name                    Total Physical   Properties
      my-pool   2 GiB / 41.63 MiB / 1.96 GiB      ~Ca,~Cr
  4. Create the Stratis file system.

    1. Create the file system in the pool.

      [root@servera ~]# stratis fs create my-pool my-fs
    2. Confirm the Stratis file system creation.

      [root@servera ~]# stratis fs list my-pool
      Pool Name Name  Used    Created           Device                     UUID
      my-pool   my-fs 546 MiB Oct 04 2021 23:47 /dev/stratis/my-pool/my-fs b6588...
    3. Create a /test directory and mount the Stratis file system.

      [root@servera ~]# mkdir /test
      [root@servera ~]# mount /dev/stratis/my-pool/my-fs /test
    4. Verify the Stratis file system.

      [root@servera ~]# df -h /test
      Filesystem                                  Size  Used Avail Use% Mounted on
      /dev/mapper/stratis-1-8c1...-thin-fs-b6...  1.0T  7.2G 1017G   1% /test
  5. Explore the features of Stratis file systems.

    1. Inspect the file system format type.

      [root@servera ~]# blkid /dev/stratis/my-pool/my-fs
      /dev/stratis/my-pool/my-fs: UUID="b658..." BLOCK_SIZE="512" TYPE="xfs"
    2. Create a snapshot of the file system and verify it.

      [root@servera ~]# stratis fs snapshot my-pool my-fs my-fs-snapshot
      [root@servera ~]# stratis fs
      Pool Name Name           Used    Created           Device                              UUID
      my-pool   my-fs          546 MiB Oct 04 2021 23:47 /dev/stratis/my-pool/my-fs          b6588...
      my-pool   my-fs-snapshot 546 MiB Oct 05 2021 00:33 /dev/stratis/my-pool/my-fs-snapshot 1cf51...
    3. Create a test file and use a snapshot as a file system backup.

      [root@servera ~]# echo "Hello, I am a test file" > /test/mytestfile
      [root@servera ~]# cat /test/mytestfile
      Hello, I am a test file

      Back up the current file system state and verify it.

      [root@servera ~]# stratis filesystem snapshot my-pool my-fs my-fs-backup
      [root@servera ~]# stratis fs
      my-pool my-fs          546 MiB Oct 04 2021 23:47 /dev/stratis/my-pool/my-fs          b6588...
      my-pool my-fs-snapshot 546 MiB Oct 05 2021 00:33 /dev/stratis/my-pool/my-fs-snapshot 1cf51...
      my-pool my-fs-backup   546 MiB Oct 05 2021 00:39 /dev/stratis/my-pool/my-fs-backup   d25b5...

      Create a /bkp directory and mount the backup file system on it.

      [root@servera ~]# mkdir /bkp
      [root@servera ~]# mount /dev/stratis/my-pool/my-fs-backup /bkp
      [root@servera ~]# df -h /bkp
      Filesystem                                  Size  Used Avail Use% Mounted on
      /dev/mapper/stratis-1-8cc...-thin-fs-d2...  1.0T  7.2G 1017G   1% /bkp
      [root@servera ~]# cat /bkp/mytestfile
      Hello, I am a test file
    4. Use the file system backup to restore the original file system.

      Unmount and destroy the file system.

      [root@servera ~]# umount /dev/stratis/my-pool/my-fs
      [root@servera ~]# stratis filesystem destroy my-pool my-fs
      [root@servera ~]# stratis fs
      Pool Name Name           Used    Created           Device                              UUID
      my-pool   my-fs-snapshot 546 MiB Oct 05 2021 00:33 /dev/stratis/my-pool/my-fs-snapshot 1cf51...
      my-pool   my-fs-backup   546 MiB Oct 05 2021 00:39 /dev/stratis/my-pool/my-fs-backup   d25b5...

      Use the original file system name to back up the my-fs-backup snapshot and mount it on the /test directory. Confirm the restore.

      [root@servera ~]# stratis filesystem snapshot my-pool my-fs-backup my-fs
      [root@servera ~]# stratis fs
      my-pool my-fs-snapshot 546 MiB Oct 05 2021 00:33 /dev/stratis/my-pool/my-fs-snapshot 1cf51...
      my-pool my-fs-backup   546 MiB Oct 05 2021 00:39 /dev/stratis/my-pool/my-fs-backup   d25b5...
      my-pool my-fs          546 MiB Oct 05 2021 00:53 /dev/stratis/my-pool/my-fs          ca12d...
      [root@servera ~]# mount /dev/stratis/my-pool/my-fs /test
      [root@servera ~]# cat /test/mytestfile
      Hello, I am a test file
  6. Return to workstation as the student user.

    [root@servera ~]# exit
    [student@servera ~]$ exit
    [student@workstation ~]$

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish storage-overview

Revision: rh342-8.4-6dd89bd