In this exercise, you will use Stratis to create file systems from pools of storage provided by physical storage devices.
Outcomes
You should be able to:
Create a thin-provisioned file system using 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.
Log in to workstation as student using student as the password.
On workstation, run lab advstorage-stratis start to start the exercise.
This script sets up the environment correctly and ensures that the additional disks on servera are clean.
[student@workstation ~]$lab advstorage-stratis start
From workstation, open an SSH session to servera as student.
[student@workstation ~]$ssh student@servera...output omitted...[student@servera ~]$
Switch to the root user.
[student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Install the stratisd and stratis-cli packages using the yum command.
[root@servera ~]#yum install stratisd stratis-cli...output omitted...Is this ok [y/N]:y...output omitted... Complete!
Activate the stratisd service using the systemctl command.
[root@servera ~]#systemctl enable --now stratisd
Ensure that the stratispool1 Stratis pool exists with the block device /dev/vdb.
Create a Stratis pool named stratispool1 using the stratis pool create command.
[root@servera ~]#stratis pool create stratispool1 /dev/vdb
Verify the availability of stratispool1 using the stratis pool list command.
[root@servera ~]#stratis pool listName Total Physical stratispool15 GiB/ 37.63 MiB / 4.96 GiB
Note the size of the pool in the preceding output.
Expand the capacity of stratispool1 using the /dev/vdc block device.
Add the block device /dev/vdc to stratispool1 using the stratis pool add-data command.
[root@servera ~]#stratis pool add-data stratispool1 /dev/vdc
Verify the size of stratispool1 using the stratis pool list command.
[root@servera ~]#stratis pool listName Total Physical stratispool110 GiB/ 41.63 MiB / 9.96 GiB
As shown above, the stratispool1 pool size increased when you added the block device.
Verify the block devices that are currently members of stratispool1 using the stratis blockdev list command.
[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 named stratis-filesystem1 in the pool stratispool1.
Mount the file system on /stratisvol.
Create a file on the stratis-filesystem1 file system named file1 containing the text Hello World!.
Create the thin-provisioned file system stratis-filesystem1 on stratispool1 using the stratis filesystem create command.
It may take up to a minute for the command to complete.
[root@servera ~]#stratis filesystem create stratispool1 stratis-filesystem1
Verify the availability of stratis-filesystem1 using the stratis filesystem list command.
[root@servera ~]#stratis filesystem listPool Name Name Used Created Device UUID stratispool1stratis-filesystem1546 MiB Mar 29 2019 07:48 /stratis/stratispool1/stratis-filesystem1 8714...e7db
Note the current usage of stratis-filesystem1.
This usage of the file system increases on-demand in the following steps.
Create a directory named /stratisvol using the mkdir command.
[root@servera ~]#mkdir /stratisvol
Mount stratis-filesystem1 on /stratisvol using the mount command.
[root@servera ~]#mount /stratis/stratispool1/stratis-filesystem1 /stratisvol
Verify that the stratis-filesystem1 volume is mounted on /stratisvol using the mount command.
[root@servera ~]#mount...output omitted... /dev/mapper/stratis-1-5c0e...12b9-thin-fs-8714...e7db on /stratisvol type xfs (rw,relatime,seclabel,attr2,inode64,sunit=2048,swidth=2048,noquota)
Create the text file /stratisvol/file1 using the echo command.
[root@servera ~]#echo "Hello World!" > /stratisvol/file1
Verify that the thin-provisioned file system stratis-filesystem1 dynamically grows as the data on the file system grows.
View the current usage of stratis-filesystem1 using the stratis filesystem list command.
[root@servera ~]#stratis filesystem listPool Name Name Used Created Device UUID stratispool1 stratis-filesystem1546 MiBMar 29 2019 07:48 /stratis/stratispool1/stratis-filesystem1 8714...e7db
Create a 2 GiB file on stratis-filesystem1 using the dd command.
It may take up to a minute for the command to complete.
[root@servera ~]#dd if=/dev/urandom of=/stratisvol/file2 bs=1M count=2048
Verify the usage of stratis-filesystem1 using the stratis filesystem list command.
[root@servera ~]#stratis filesystem listPool Name Name Used Created Device UUID stratispool1 stratis-filesystem12.53 GiBMar 29 2019 07:48 /stratis/stratispool1/stratis-filesystem1 8714...e7db
The preceding output shows that the usage of stratis-filesystem1 has increased.
The increase in the usage confirms that the thin-provisioned file system has dynamically expanded to accommodate the real-time data growth you created with /stratisvol/file2.
Create a snapshot of stratis-filesystem1 named stratis-filesystem1-snap.
The snapshot will provide you with access to any file that is deleted from stratis-filesystem1.
Create a snapshot of stratis-filesystem1 using the stratis filesystem snapshot command.
It may take up to a minute for the command to complete.
The following command is long and should be entered as a single line.
[root@servera ~]#stratis filesystem snapshot stratispool1 stratis-filesystem1 stratis-filesystem1-snap
Verify the availability of the snapshot using the stratis filesystem list command.
[root@servera ~]#stratis filesystem list...output omitted... stratispool1stratis-filesystem1-snap2.53 GiB Mar 29 2019 10:28 /stratis/stratispool1/stratis-filesystem1-snap 291d...8a16
Remove the /stratisvol/file1 file.
[root@servera ~]#rm /stratisvol/file1rm: remove regular file '/stratisvol/file1'?y
Create the directory /stratisvol-snap using the mkdir command.
[root@servera ~]#mkdir /stratisvol-snap
Mount the stratis-filesystem1-snap snapshot on /stratisvol-snap using the mount command.
The following command is long and should be entered as a single line.
[root@servera ~]#mount /stratis/stratispool1/stratis-filesystem1-snap /stratisvol-snap
Confirm that you can still access the file you deleted from stratis-filesystem1 using the stratis-filesystem1-snap snapshot.
[root@servera ~]#cat /stratisvol-snap/file1Hello World!
Unmount /stratisvol and /stratisvol-snap using the umount command.
[root@servera ~]#umount /stratisvol-snap[root@servera ~]#umount /stratisvol
Remove the thin-provisioned file system stratis-filesystem1 and its snapshot stratis-filesystem1-snap from the system.
Destroy stratis-filesystem1-snap using the stratis filesystem destroy command.
[root@servera ~]#stratis filesystem destroy stratispool1 stratis-filesystem1-snap
Destroy stratis-filesystem1 using the stratis filesystem destroy command.
[root@servera ~]#stratis filesystem destroy stratispool1 stratis-filesystem1
Exit the root user's shell and log out of servera.
[root@servera ~]#exitlogout[student@servera ~]$exitlogout Connection to servera closed.[student@workstation ~]$