新聞中心
Stratis 是一個卷管理文件系統(tǒng)volume-managing filesystem(VMF),類似于 ZFS 和 Btrfs。它使用了存儲“池”的核心思想,該思想被各種 VMF 和 形如 LVM 的獨立卷管理器采用,下面為大家分享一下Linux下Stratis具體使用方法。

成都創(chuàng)新互聯(lián)公司專注于企業(yè)全網(wǎng)整合營銷推廣、網(wǎng)站重做改版、邵東網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、H5建站、商城網(wǎng)站建設(shè)、集團公司官網(wǎng)建設(shè)、外貿(mào)營銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為邵東等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
img
為了開始使用Stratis,我們需要添加一些磁盤設(shè)備,并創(chuàng)建一個單獨的池,在一個Stratis池中,可以創(chuàng)建多個文件系統(tǒng)。
安裝Stratis
通過下面命令使用yum安裝stratis:
[root@localhost ~]# yum -y install stratis*
安裝完成之后,設(shè)置開機啟用并立即啟動:
[root@localhost ~]# systemctl enable stratisd --now
查看以下是否啟動:
列出可用磁盤
在這添加了5個2GB磁盤,使用下面命令列出磁盤:
[root@localhost ~]# lsblk
在Centos8 中使用Stratis管理本地存儲(一)在Centos8 中使用Stratis管理本地存儲(一)
列出現(xiàn)有的池和文件系統(tǒng):
使用下面幾條命令列出塊設(shè)備、stratis池、文件系統(tǒng):
[root@localhost ~]# stratis blockdev list
[root@localhost ~]# stratis pool list
[root@localhost ~]# stratis filesystem list
在Centos8 中使用Stratis管理本地存儲(一)在Centos8 中使用Stratis管理本地存儲(一)
創(chuàng)建池和文件系統(tǒng)
首先,我們創(chuàng)建“data01_pool”的池。將/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd添加到該池中:
[root@localhost ~]# stratis pool create data01_pool /dev/sd{a..d}
[root@localhost ~]# stratis pool list
[root@localhost ~]# stratis blockdev list
上面命令創(chuàng)建”data01_pool”池、查看池、查看塊設(shè)備。
下面從“data01_pool”池中創(chuàng)建兩個文件系統(tǒng):
[root@localhost ~]# stratis filesystem create data01_pool user_data01
[root@localhost ~]# stratis filesystem create data01_pool user_data02
下面命令列出創(chuàng)建的文件系統(tǒng):
[root@localhost ~]# stratis filesystem list
或者
[root@localhost ~]# stratis fs list
上圖中列出的文件系統(tǒng)中,字段Device是stratis設(shè)備的位置。
掛載創(chuàng)建好的文件系統(tǒng)
一旦從池中創(chuàng)建了文件系統(tǒng),請創(chuàng)建一個掛載點并掛載文件系統(tǒng)。默認情況下在創(chuàng)建文件系統(tǒng)時,它將使用XFS文件系統(tǒng)對其進行格式化。
# 創(chuàng)建掛載點
[root@localhost ~]# mkdir /user_data01
[root@localhost ~]# mkdir /user_data02
# 掛載文件系統(tǒng)
[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*
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-0657c26979ed443aa4d3a70c15606e1c 1.0T 7.2G 1017G 1% /user_data01
/dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-b91b970f23d94eb6b2ed56f347f770d2 1.0T 7.2G 1017G 1% /user_data02
希望你已經(jīng)觀察到我們沒有格式化文件系統(tǒng)。Stratis程序為我們解決了這一問題,并創(chuàng)建了XFS類型的文件系統(tǒng)。
同樣,由于自動精簡配置,默認情況下,它將顯示文件系統(tǒng)大小為1 TB,并且該大小僅是虛擬的,而不是實際的。要檢查實際大小,您將必須使用Stratis命令
使用df -hT /user*匹配出user_data01和user_data02掛載點的文件系統(tǒng),可以看到他們的類型都是XFS格式。
在/etc/fstab中添加開機掛載的條目
首先需要獲取文件系統(tǒng)的UUID,有兩種方式:
第一種方式,是通過使用stratis fs list就可以獲取到文件系統(tǒng)的UUID。
[root@localhost ~]# stratis fs list
第二種方式,使用blkid獲取塊存儲的uuid,過濾出stratis文件系統(tǒng):
[root@localhost ~]# blkid|grep stratis
下面就是將掛在信息寫入到/etc/fstab中:
[root@localhost ~]# echo "UUID=0657c26979ed443aa4d3a70c15606e1c /user_data01 xfs defaults,x-systemd.requires=stratis.service 0 0" >> /etc/fstab
[root@localhost ~]# echo "UUID=b91b970f23d94eb6b2ed56f347f770d2 /user_data02 xfs defaults,x-systemd.requires=stratis.service 0 0" >> /etc/fstab
在Centos8 中使用Stratis管理本地存儲(一)在Centos8 中使用Stratis管理本地存儲(一)
檢查Stratis守護程序版本
如果需要檢查Stratis運行的守護進程版本,使用如下命令:
[root@localhost ~]# stratis daemon version
2.1.0
在Centos8 中使用Stratis管理本地存儲(一)在Centos8 中使用Stratis管理本地存儲(一)
總結(jié)
Stratis是RHEL8/Centos8中提供的一個新的本地存儲管理工具,它將有助于在塊設(shè)備上創(chuàng)建分層存儲。在RHEL8/Centos8中,可以通過安裝兩個軟件包獲得Stratis。文章第二部分:https://www.linuxprobe.com/?p=213460
文章標題:Linux下Stratis具體使用方法
分享URL:http://fisionsoft.com.cn/article/cdehpso.html


咨詢
建站咨詢
