Stratis是RHEL8/Centos8中提供的一种新的本地存储管理工具,有助于在块设备上创建分层存储。在RHEL8/Centos8中,安装两个包即可获得Stratis。在RHEL7中我们有BTRFS文件系统,RedHat在RHEL8中移除了BTRFS支持并提供了Stratis本地存储管理系统。为了开始使用Stratis,我们需要添加一些磁盘设备并创建一个单独的池。在Stratis池中,可以创建多个文件系统。安装Stratis使用以下命令使用yum安装stratis:[root@localhost~]#yum-yinstallstratis*Centos8中使用Stratis管理本地存储(一)Centos8中使用Stratis管理本地存储(一)安装完成后完成后,设置Startitup,立即启动:[root@localhost~]#systemctlenablestratisd--now查看是否启动如下:Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储Centos8(一)Listavailabledisks此处添加了5个2GB的磁盘,使用以下命令列出磁盘:[root@localhost~]#lsblkCentos8中使用Stratis管理本地存储(一)Centos8中使用Stratis管理本地存储(1)列出已有的Pool和文件系统:使用以下命令列出块设备、stratispool和文件系统:[root@localhost~]#stratisblockdevlist[root@localhost~]#stratispoollist[root@localhost~]#stratisfilesystemlist在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)创建池和文件系统首先,我们创建一个池“data01_pool”。将/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd添加到池中:[root@localhost~]#stratispoolcreatedata01_pool/dev/sd{a..d}[root@localhost~]#stratispoollist[root@localhost~]#stratisblockdevlist在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)通过以上命令创建“data01_pool”池,查看池,查看块设备。从“data01_pool”池中创建两个文件系统:[root@localhost~]#stratisfilesystemcreatedata01_pooluser_data01[root@localhost~]#stratisfilesystemcreatedata01_pooluser_data02以下命令列出创建的文件系统:[root@localhost~]#stratisfilesystemlistor[root@localhost~]#stratisfslist在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)在上图列出的文件系统中,字段Device是stratis设备的位置。挂载创建的文件系统从池中创建文件系统后,创建挂载点并挂载文件系统。默认情况下,在创建文件系统时,它将使用XFS文件系统对其进行格式化。创建挂载点[root@localhost~]#mkdir/user_data01[root@localhost~]#mkdir/user_data02挂载文件系统[root@localhost~]#mount/stratis/data01_pool/user_data01/user_data01/[root@localhost~]#mount/stratis/data01_pool/user_data02/user_data02/在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)使用df-h查看挂载状态:[root@localhost~]#df-h/user_data*FilesystemSizeUsedAvailUse%Mountedon/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-0657c26979ed443aa4d3a70c15606e1c1.0T7.2G1017G1%/user_data01/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-b91b970f23d94eb6b2ed56f347f770d21.0T7.2G1017G1%/user_data02在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)希望您注意到我们没有格式化文件系统。Stratis程序为我们处理了这个并创建了一个XFS类型的文件系统。此外,由于自动精简配置,默认情况下它会将文件系统大小显示为1TB,并且该大小只是虚拟的,而不是真实的。要查看实际大小,您将不得不使用Stratis命令df-hT/user*来匹配user_data01和user_data02挂载点的文件系统,您可以看到它们都是XFS格式。在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)在/etc/fstab中添加启动挂载项首先需要获取文件系统的UUID。有两种方式:第一种方式是使用stratisfslist获取文件系统的UUID。[root@localhost~]#stratisfslistCentos8中使用Stratis管理本地存储(一)Centos8中使用Stratis管理本地存储(一)第二种方式,使用blkid获??取块存储的uuid,过滤掉stratis文件系统:[root@localhost~]#blkid|grepstratisCentos8中使用Stratis管理本地存储(一)Centos8中使用Stratis管理本地存储(一)下面是将挂起信息写入/etc/fstab:[root@localhost~]#echo"UUID=0657c26979ed443aa4d3a70c15606e1c/user_data01xfsdefaults,x-systemd.requires=stratis.service00">>/etc/fstab[root@localhost~]#echo"UUID=b91b970f23d94eb6b27f_xfa,x-systemd.requires=stratis.service00">>/etc/fstab在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)检查Stratisdaemon版本必要时检查Stratisrunningdaemon版本,使用以下命令:[root@localhost~]#stratisdaemonversion2.1.0在Centos8中使用Stratis管理本地存储(一)在Centos8中使用Stratis管理本地存储(一)总结Stratis是RHEL8/一个新的CentOS8中提供的本地存储管理工具将有助于在块设备上创建分层存储。在RHEL8/Centos8中,安装两个包即可获得Stratis。
