Bookmark this page

Guided Exercise: Manage Layered Storage

Use Stratis to create file systems from pools of storage that physical storage devices provide.

Outcomes

  • Create a thin-provisioned file system by using the Stratis storage management solution.

  • Verify that the Stratis volumes grow dynamically to support real-time data growth.

  • Access data from the snapshot of a thin-provisioned file system.

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

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start lvm-stratis

Instructions

  1. Log in to the servera machine as the student user 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 the stratisd and stratis-cli packages.

    [root@servera ~]# dnf install stratisd stratis-cli
    ...output omitted...
    Is this ok [y/N]: y
    ...output omitted...
    Complete!
  3. Activate the stratisd service.

    [root@servera ~]# systemctl enable --now stratisd
  4. Ensure that the stratispool1 Stratis pool exists on the /dev/vdb block device.

    1. Create the stratispool1 Stratis pool.

      [root@servera ~]# stratis pool create stratispool1 /dev/vdb
    2. Verify the availability of the stratispool1 pool. Note the size of the pool.

      [root@servera ~]# stratis pool list
      Name                         Total Physical   Properties              UUID
      stratispool1   5 GiB / 37.63 MiB / 4.96 GiB      ~Ca,~Cr   3557c389-7...
  5. Expand the capacity of the stratispool1 pool by adding the /dev/vdc block device.

    1. Add the /dev/vdc block device to the stratispool1 pool.

      [root@servera ~]# stratis pool add-data stratispool1 /dev/vdc
    2. Verify the size of the stratispool1 pool. The stratispool1 pool size increases when you add the block device.

      [root@servera ~]# stratis pool list
      Name                          Total Physical   Properties            UUID
      stratispool1   10 GiB / 41.63 MiB / 9.96 GiB      ~Ca,~Cr   3557c389-7...
    3. Verify the block devices that are currently members of the stratispool1 pool.

      [root@servera ~]# stratis blockdev list stratispool1
      Pool Name     Device Node  Physical Size  Tier
      stratispool1  /dev/vdb             5 GiB  Data
      stratispool1  /dev/vdc             5 GiB  Data
  6. Add a thin-provisioned file system called stratis-filesystem1 in the stratispool1 pool. Mount the file system on the /stratisvol directory. Create a file on the stratis-filesystem1 file system called file1 that contains the text Hello World!. Modify the /etc/fstab file to persistently mount the file system on the /stratisvol directory.

    1. Create the thin-provisioned stratis-filesystem1 file system on the stratispool1 pool. It might take up to a minute for the command to complete.

      [root@servera ~]# stratis filesystem create stratispool1 stratis-filesystem1
    2. Verify the availability of the stratis-filesystem1 file system, and note its current usage. The usage of the file system increases on demand in the later steps.

      [root@servera ~]# stratis filesystem list
      Pool Name      Name                  Used      Created             Device                                          UUID
      stratispool1   stratis-filesystem1   546 MiB   Apr 08 2022 07:12   /dev/stratis/stratispool1/stratis-filesystem1   48e8...
    3. Create the /stratisvol directory.

      [root@servera ~]# mkdir /stratisvol
    4. Mount the stratis-filesystem1 file system on the /stratisvol directory.

      [root@servera ~]# mount /dev/stratis/stratispool1/stratis-filesystem1 \
      /stratisvol
    5. Create the /stratisvol/file1 text file.

      [root@servera ~]# echo "Hello World!" > /stratisvol/file1
    6. Unmount the /stratisvol volume.

      [root@servera ~]# umount /stratisvol
    7. Obtain the UUID of the file system. The UUID would be different in your system.

      [root@servera ~]# lsblk --output=UUID \
      /dev/stratis/stratispool1/stratis-filesystem1
      UUID
      d18cb4fc-753c-473a-9ead-d6661533b475
    8. Modify the /etc/fstab file to persistently mount the file system on the /stratisvol directory. To do so, use the vim /etc/fstab command and add the following line. Replace the UUID with the correct one for your system.

      UUID=d18c... /stratisvol xfs defaults,x-systemd.requires=stratisd.service 0 0
    9. Update the systemd daemon with the new /etc/fstab configuration file.

      [root@servera ~]# systemctl daemon-reload
    10. Mount the stratisvol volume and verify that the stratis-filesystem1 volume is mounted on the /stratisvol directory.

      [root@servera ~]# mount /stratisvol
      [root@servera ~]# mount
      ...output omitted...
      /dev/mapper/stratis-1-3557...fbd3-thin-fs-48e8...9ebe on /stratisvol type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,sunit=2048,swidth=2048,
      noquota)
  7. Reboot your system and verify that the file system is persistently mounted across reboots.

    [root@servera ~]# systemctl reboot
    ...output omitted...
    [student@workstation ~]$ ssh student@servera
    ...output omitted...
    [student@servera ~]$ sudo -i
    [sudo] password for student: student
    [root@servera ~]# mount
    ...output omitted...
    /dev/mapper/stratis-1-3557...fbd3-thin-fs-d18c...b475 on /stratisvol type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,sunit=2048,swidth=2048,
    noquota,x-systemd.requires=stratisd.service)
  8. Verify that the stratis-filesystem1 thin-provisioned file system dynamically grows as the data on the file system grows.

    1. View the current usage of the stratis-filesystem1 file system.

      [root@servera ~]# stratis filesystem list
      Pool Name      Name                  Used      Created             Device                                          UUID
      stratispool1   stratis-filesystem1   546 MiB   Apr 08 2022 07:12   /dev/stratis/stratispool1/stratis-filesystem1   48e8...
    2. Create a 2 GiB file on the stratis-filesystem1 file system. It might take up to a minute for the command to complete.

      [root@servera ~]# dd if=/dev/urandom of=/stratisvol/file2 bs=1M count=2048
    3. Verify the used space in the stratis-filesystem1 file system.

      The output shows that the used space in the stratis-filesystem1 file system increased. The used-space increase confirms that the thin-provisioned file system dynamically expands as needed.

      [root@servera ~]# stratis filesystem list
      Pool Name      Name                  Used      Created             Device                                          UUID
      stratispool1   stratis-filesystem1   2.60 GiB   Apr 08 2022 07:12   /dev/stratis/stratispool1/stratis-filesystem1   48e8...
  9. Create a snapshot called stratis-filesystem1-snap of the stratis-filesystem1 file system. The snapshot provides you with access to any file that you delete from the stratis-filesystem1 file system.

    1. Create a snapshot of the stratis-filesystem1 file system. It might take up to a minute for the command to complete.

      [root@servera ~]# stratis filesystem snapshot stratispool1 \
      stratis-filesystem1 stratis-filesystem1-snap
    2. Verify the availability of the snapshot.

      [root@servera ~]# stratis filesystem list
      Pool Name      Name                       Used       Created             Device                                               UUID
      stratispool1   stratis-filesystem1-snap   2.73 GiB   Apr 08 2022 07:22   /dev/stratis/stratispool1/stratis-filesystem1-snap   5774...
      stratispool1   stratis-filesystem1        2.73 GiB   Apr 08 2022 07:12   /dev/stratis/stratispool1/stratis-filesystem1        48e8...
    3. Remove the /stratisvol/file1 file.

      [root@servera ~]# rm /stratisvol/file1
      rm: remove regular file '/stratisvol/file1'? y
    4. Create the /stratisvol-snap directory.

      [root@servera ~]# mkdir /stratisvol-snap
    5. Mount the stratis-filesystem1-snap snapshot on the /stratisvol-snap directory.

      [root@servera ~]# mount /dev/stratis/stratispool1/stratis-filesystem1-snap \
      /stratisvol-snap
    6. Verify that you can still access the file that you deleted from the stratis-filesystem1 file system in the snapshot.

      [root@servera ~]# cat /stratisvol-snap/file1
      Hello World!
  10. Unmount the /stratisvol and /stratisvol-snap volumes.

    [root@servera ~]# umount /stratisvol-snap
    [root@servera ~]# umount /stratisvol
  11. Remove the stratis-filesystem1 thin-provisioned file system and the stratis-filesystem1-snap snapshot from the system.

    1. Destroy the stratis-filesystem1-snap snapshot.

      [root@servera ~]# stratis filesystem destroy stratispool1 stratis-filesystem1-snap
    2. Destroy the stratis-filesystem1 file system.

      [root@servera ~]# stratis filesystem destroy stratispool1 stratis-filesystem1
    3. Return to the workstation system as the student user.

      [root@servera ~]# exit
      logout
      [student@servera ~]$ exit
      logout
      Connection to servera closed.
      [student@workstation ~]$

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish lvm-stratis

Revision: rh134-9.3-5fd2368