Red Hat System Administration II
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
Log in to the
serveramachine as thestudentuser and switch to therootuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#Install the
stratisdandstratis-clipackages.[root@servera ~]#
dnf install stratisd stratis-cli...output omitted... Is this ok [y/N]:y...output omitted... Complete!Activate the
stratisdservice.[root@servera ~]#
systemctl enable --now stratisdEnsure that the
stratispool1Stratis pool exists on the/dev/vdbblock device.Create the
stratispool1Stratis pool.[root@servera ~]#
stratis pool create stratispool1 /dev/vdbVerify the availability of the
stratispool1pool. Note the size of the pool.[root@servera ~]#
stratis pool listName Total Physical Properties UUID stratispool15 GiB/ 37.63 MiB / 4.96 GiB ~Ca,~Cr 3557c389-7...
Expand the capacity of the
stratispool1pool by adding the/dev/vdcblock device.Add the
/dev/vdcblock device to thestratispool1pool.[root@servera ~]#
stratis pool add-data stratispool1 /dev/vdcVerify the size of the
stratispool1pool. Thestratispool1pool size increases when you add the block device.[root@servera ~]#
stratis pool listName Total Physical Properties UUID stratispool110 GiB/ 41.63 MiB / 9.96 GiB ~Ca,~Cr 3557c389-7...Verify the block devices that are currently members of the
stratispool1pool.[root@servera ~]#
stratis blockdev list stratispool1Pool Name Device Node Physical Size Tier stratispool1 /dev/vdb 5 GiB Data stratispool1 /dev/vdc 5 GiB Data
Add a thin-provisioned file system called
stratis-filesystem1in thestratispool1pool. Mount the file system on the/stratisvoldirectory. Create a file on thestratis-filesystem1file system calledfile1that contains the textHello World!. Modify the/etc/fstabfile to persistently mount the file system on the/stratisvoldirectory.Create the thin-provisioned
stratis-filesystem1file system on thestratispool1pool. It might take up to a minute for the command to complete.[root@servera ~]#
stratis filesystem create stratispool1 stratis-filesystem1Verify the availability of the
stratis-filesystem1file system, and note its current usage. The usage of the file system increases on demand in the later steps.[root@servera ~]#
stratis filesystem listPool Name Name Used Created Device UUID stratispool1stratis-filesystem1546 MiB Apr 08 2022 07:12 /dev/stratis/stratispool1/stratis-filesystem1 48e8...Create the
/stratisvoldirectory.[root@servera ~]#
mkdir /stratisvolMount the
stratis-filesystem1file system on the/stratisvoldirectory.[root@servera ~]#
mount /dev/stratis/stratispool1/stratis-filesystem1 \/stratisvolCreate the
/stratisvol/file1text file.[root@servera ~]#
echo "Hello World!" > /stratisvol/file1Unmount the
/stratisvolvolume.[root@servera ~]#
umount /stratisvolObtain the UUID of the file system. The UUID would be different in your system.
[root@servera ~]#
lsblk --output=UUID \ /dev/stratis/stratispool1/stratis-filesystem1UUIDd18cb4fc-753c-473a-9ead-d6661533b475Modify the
/etc/fstabfile to persistently mount the file system on the/stratisvoldirectory. To do so, use thevim /etc/fstabcommand 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 0Update the
systemddaemon with the new/etc/fstabconfiguration file.[root@servera ~]#
systemctl daemon-reloadMount the
stratisvolvolume and verify that thestratis-filesystem1volume is mounted on the/stratisvoldirectory.[root@servera ~]#
mount /stratisvol[root@servera ~]#mount...output omitted... /dev/mapper/stratis-1-3557...fbd3-thin-fs-48e8...9ebe on/stratisvoltype xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,sunit=2048,swidth=2048, noquota)
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/stratisvoltype xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,sunit=2048,swidth=2048, noquota,x-systemd.requires=stratisd.service)Verify that the
stratis-filesystem1thin-provisioned file system dynamically grows as the data on the file system grows.View the current usage of the
stratis-filesystem1file system.[root@servera ~]#
stratis filesystem listPool Name Name Used Created Device UUID stratispool1 stratis-filesystem1546 MiBApr 08 2022 07:12 /dev/stratis/stratispool1/stratis-filesystem1 48e8...Create a 2 GiB file on the
stratis-filesystem1file 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=2048Verify the used space in the
stratis-filesystem1file system.The output shows that the used space in the
stratis-filesystem1file system increased. The used-space increase confirms that the thin-provisioned file system dynamically expands as needed.[root@servera ~]#
stratis filesystem listPool Name Name Used Created Device UUID stratispool1 stratis-filesystem12.60 GiBApr 08 2022 07:12 /dev/stratis/stratispool1/stratis-filesystem1 48e8...
Create a snapshot called
stratis-filesystem1-snapof thestratis-filesystem1file system. The snapshot provides you with access to any file that you delete from thestratis-filesystem1file system.Create a snapshot of the
stratis-filesystem1file system. It might take up to a minute for the command to complete.[root@servera ~]#
stratis filesystem snapshot stratispool1 \ stratis-filesystem1 stratis-filesystem1-snapVerify the availability of the snapshot.
[root@servera ~]#
stratis filesystem listPool Name Name Used Created Device UUID stratispool1stratis-filesystem1-snap2.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...Remove the
/stratisvol/file1file.[root@servera ~]#
rm /stratisvol/file1rm: remove regular file '/stratisvol/file1'?yCreate the
/stratisvol-snapdirectory.[root@servera ~]#
mkdir /stratisvol-snapMount the
stratis-filesystem1-snapsnapshot on the/stratisvol-snapdirectory.[root@servera ~]#
mount /dev/stratis/stratispool1/stratis-filesystem1-snap \ /stratisvol-snapVerify that you can still access the file that you deleted from the
stratis-filesystem1file system in the snapshot.[root@servera ~]#
cat /stratisvol-snap/file1Hello World!
Unmount the
/stratisvoland/stratisvol-snapvolumes.[root@servera ~]#
umount /stratisvol-snap[root@servera ~]#umount /stratisvolRemove the
stratis-filesystem1thin-provisioned file system and thestratis-filesystem1-snapsnapshot from the system.Destroy the
stratis-filesystem1-snapsnapshot.[root@servera ~]#
stratis filesystem destroy stratispool1 stratis-filesystem1-snapDestroy the
stratis-filesystem1file system.[root@servera ~]#
stratis filesystem destroy stratispool1 stratis-filesystem1Return to the
workstationsystem as thestudentuser.[root@servera ~]#
exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$