In this exercise, you 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 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 ~]#
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!
Activate the stratisd service.
[root@servera ~]# systemctl enable --now stratisdEnsure that the stratispool1 Stratis pool exists on the /dev/vdb block device.
Create the stratispool1 Stratis pool.
[root@servera ~]# stratis pool create stratispool1 /dev/vdbVerify the availability of the stratispool1 pool.
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 stratispool1 pool by adding the /dev/vdc block device.
Add the /dev/vdc block device to the stratispool1 pool.
[root@servera ~]# stratis pool add-data stratispool1 /dev/vdcVerify the size of the stratispool1 pool.
The stratispool1 pool 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 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 DataAdd 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.
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-filesystem1Verify 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 listPool Name Name Used Created Device UUID stratispool1stratis-filesystem1546 MiB Apr 08 2022 07:12 /dev/stratis/stratispool1/stratis-filesystem1 48e8...
Create the /stratisvol directory.
[root@servera ~]# mkdir /stratisvolMount the stratis-filesystem1 file system on the /stratisvol directory.
[root@servera ~]#mount /dev/stratis/stratispool1/stratis-filesystem1 \/stratisvol
Create the /stratisvol/file1 text file.
[root@servera ~]# echo "Hello World!" > /stratisvol/file1Unmount the /stratisvol volume.
[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-d6661533b475
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 0Update the systemd daemon with the new /etc/fstab configuration file.
[root@servera ~]# systemctl daemon-reloadMount 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/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-filesystem1 thin-provisioned file system dynamically grows as the data on the file system grows.
View the current usage of the stratis-filesystem1 file 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-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=2048Verify 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 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-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.
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-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/file1 file.
[root@servera ~]#rm /stratisvol/file1rm: remove regular file '/stratisvol/file1'?y
Create the /stratisvol-snap directory.
[root@servera ~]# mkdir /stratisvol-snapMount the stratis-filesystem1-snap snapshot on the /stratisvol-snap directory.
[root@servera ~]# mount /dev/stratis/stratispool1/stratis-filesystem1-snap \
/stratisvol-snapVerify 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!Unmount the /stratisvol and /stratisvol-snap volumes.
[root@servera ~]#umount /stratisvol-snap[root@servera ~]#umount /stratisvol
Remove the stratis-filesystem1 thin-provisioned file system and the stratis-filesystem1-snap snapshot from the system.
Destroy the stratis-filesystem1-snap snapshot.
[root@servera ~]# stratis filesystem destroy stratispool1 stratis-filesystem1-snapDestroy the stratis-filesystem1 file system.
[root@servera ~]# stratis filesystem destroy stratispool1 stratis-filesystem1Return to the workstation system as the student user.
[root@servera ~]#exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$
This concludes the section.