这篇文章主要介绍了Linux下Stratis怎么用,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

Stratis 是一个卷管理文件系统volume-managing filesystem(VMF),类似于 ZFS 和 Btrfs。它使用了存储“池”的核心思想,该思想被各种 VMF 和 形如 LVM 的独立卷管理器采用。

img

为了开始使用Stratis,我们需要添加一些磁盘设备,并创建一个单独的池,在一个Stratis池中,可以创建多个文件系统。

安装Stratis

通过下面命令使用yum安装stratis:

[root@localhost~]#yum-yinstallstratis*

安装完成之后,设置开机启用并立即启动:

[root@localhost~]#systemctlenablestratisd--now

查看以下是否启动:

列出可用磁盘

在这添加了5个2GB磁盘,使用下面命令列出磁盘:

[root@localhost~]#lsblk


列出现有的池和文件系统:

使用下面几条命令列出块设备、stratis池、文件系统:

[root@localhost~]#stratisblockdevlist[root@localhost~]#stratispoollist[root@localhost~]#stratisfilesystemlist


创建池和文件系统

首先,我们创建“data01_pool”的池。将/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd添加到该池中:

[root@localhost~]#stratispoolcreatedata01_pool/dev/sd{a..d}[root@localhost~]#stratispoollist[root@localhost~]#stratisblockdevlist

上面命令创建”data01_pool”池、查看池、查看块设备。

下面从“data01_pool”池中创建两个文件系统:

[root@localhost~]#stratisfilesystemcreatedata01_pooluser_data01[root@localhost~]#stratisfilesystemcreatedata01_pooluser_data02

下面命令列出创建的文件系统:

[root@localhost~]#stratisfilesystemlist或者[root@localhost~]#stratisfslist

上图中列出的文件系统中,字段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/

使用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

希望你已经观察到我们没有格式化文件系统。Stratis程序为我们解决了这一问题,并创建了XFS类型的文件系统。

同样,由于自动精简配置,默认情况下,它将显示文件系统大小为1 TB,并且该大小仅是虚拟的,而不是实际的。要检查实际大小,您将必须使用Stratis命令

使用df -hT /user*匹配出user_data01和user_data02挂载点的文件系统,可以看到他们的类型都是XFS格式。

在/etc/fstab中添加开机挂载的条目

首先需要获取文件系统的UUID,有两种方式:

第一种方式,是通过使用stratis fs list就可以获取到文件系统的UUID。

[root@localhost~]#stratisfslist

第二种方式,使用blkid获取块存储的uuid,过滤出stratis文件系统:

[root@localhost~]#blkid|grepstratis

下面就是将挂在信息写入到/etc/fstab中:

[root@localhost~]#echo"UUID=0657c26979ed443aa4d3a70c15606e1c/user_data01xfsdefaults,x-systemd.requires=stratis.service00">>/etc/fstab[root@localhost~]#echo"UUID=b91b970f23d94eb6b2ed56f347f770d2/user_data02xfsdefaults,x-systemd.requires=stratis.service00">>/etc/fstab


检查Stratis守护程序版本

如果需要检查Stratis运行的守护进程版本,使用如下命令:

[root@localhost~]#stratisdaemonversion2.1.0

感谢你能够认真阅读完这篇文章,希望小编分享的“Linux下Stratis怎么用”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!