自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

在 Centos 8 中使用 Stratis 管理本地存儲(chǔ)

存儲(chǔ) 存儲(chǔ)軟件
Stratis是RHEL8/Centos8中提供的一個(gè)新的本地存儲(chǔ)管理工具,它將有助于在塊設(shè)備上創(chuàng)建分層存儲(chǔ)。在RHEL8/Centos8中,可以通過安裝兩個(gè)軟件包獲得Stratis。

[[397428]]

Stratis是RHEL8/Centos8中提供的一個(gè)新的本地存儲(chǔ)管理工具,它將有助于在塊設(shè)備上創(chuàng)建分層存儲(chǔ)。在RHEL8/Centos8中,可以通過安裝兩個(gè)軟件包獲得Stratis。在RHEL7,我們有了BTRFS文件系統(tǒng),Red Hat在RHEL 8中刪除了BTRFS支持,并提供了Stratis本地存儲(chǔ)管理系統(tǒng)。

[[397429]]

為了開始使用Stratis,我們需要添加一些磁盤設(shè)備,并創(chuàng)建一個(gè)單獨(dú)的池,在一個(gè)Stratis池中,可以創(chuàng)建多個(gè)文件系統(tǒng)。

安裝Stratis

通過下面命令使用yum安裝stratis:

  1. [root@localhost ~]# yum -y install stratis* 

安裝完成之后,設(shè)置開機(jī)啟用并立即啟動(dòng):

  1. [root@localhost ~]# systemctl enable stratisd --now 

查看以下是否啟動(dòng):

列出可用磁盤

在這添加了5個(gè)2GB磁盤,使用下面命令列出磁盤:

  1. [root@localhost ~]# lsblk 

列出現(xiàn)有的池和文件系統(tǒng):

使用下面幾條命令列出塊設(shè)備、stratis池、文件系統(tǒng):

  1. [root@localhost ~]# stratis blockdev list  
  2. [root@localhost ~]# stratis pool list 
  3. [root@localhost ~]# stratis filesystem list 

創(chuàng)建池和文件系統(tǒng)

首先,我們創(chuàng)建“data01_pool”的池。將/dev/sda,/dev/sdb,/dev/sdc,/dev/sdd添加到該池中:

  1. [root@localhost ~]# stratis pool create data01_pool /dev/sd{a..d} 
  2. [root@localhost ~]# stratis pool list  
  3. [root@localhost ~]# stratis blockdev list 

上面命令創(chuàng)建"data01_pool"池、查看池、查看塊設(shè)備。

下面從“data01_pool”池中創(chuàng)建兩個(gè)文件系統(tǒng):

  1. [root@localhost ~]# stratis filesystem create data01_pool user_data01 
  2. [root@localhost ~]# stratis filesystem create data01_pool user_data02 

下面命令列出創(chuàng)建的文件系統(tǒng):

  1. [root@localhost ~]# stratis filesystem list  
  2. 或者 
  3. [root@localhost ~]# stratis fs list 

上圖中列出的文件系統(tǒng)中,字段Device是stratis設(shè)備的位置。

掛載創(chuàng)建好的文件系統(tǒng)

一旦從池中創(chuàng)建了文件系統(tǒng),請(qǐng)創(chuàng)建一個(gè)掛載點(diǎn)并掛載文件系統(tǒng)。默認(rèn)情況下在創(chuàng)建文件系統(tǒng)時(shí),它將使用XFS文件系統(tǒng)對(duì)其進(jìn)行格式化。

  1. # 創(chuàng)建掛載點(diǎn) 
  2. [root@localhost ~]# mkdir /user_data01 
  3. [root@localhost ~]# mkdir /user_data02 
  4. # 掛載文件系統(tǒng) 
  5. [root@localhost ~]# mount /stratis/data01_pool/user_data01 /user_data01/ 
  6. [root@localhost ~]# mount /stratis/data01_pool/user_data02 /user_data02/ 

使用df -h查看掛載的情況:

  1. [root@localhost ~]# df -h /user_data* 
  2. Filesystem                                                                                       Size  Used Avail Use% Mounted on 
  3. /dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-0657c26979ed443aa4d3a70c15606e1c  1.0T  7.2G 1017G   1% /user_data01 
  4. /dev/mapper/stratis-1-359fd7072d8349d390741a1a71f885fb-thin-fs-b91b970f23d94eb6b2ed56f347f770d2  1.0T  7.2G 1017G   1% /user_data02 

希望你已經(jīng)觀察到我們沒有格式化文件系統(tǒng)。Stratis程序?yàn)槲覀兘鉀Q了這一問題,并創(chuàng)建了XFS類型的文件系統(tǒng)。

同樣,由于自動(dòng)精簡配置,默認(rèn)情況下,它將顯示文件系統(tǒng)大小為1 TB,并且該大小僅是虛擬的,而不是實(shí)際的。要檢查實(shí)際大小,您將必須使用Stratis命令

使用df -hT /user*匹配出user_data01和user_data02掛載點(diǎn)的文件系統(tǒng),可以看到他們的類型都是XFS格式。

在/etc/fstab中添加開機(jī)掛載的條目

首先需要獲取文件系統(tǒng)的UUID,有兩種方式:

第一種方式,是通過使用stratis fs list就可以獲取到文件系統(tǒng)的UUID。

  1. [root@localhost ~]# stratis fs list 

第二種方式,使用blkid獲取塊存儲(chǔ)的uuid,過濾出stratis文件系統(tǒng):

  1. [root@localhost ~]# blkid|grep stratis 

下面就是將掛載信息寫入到/etc/fstab中:

  1. [root@localhost ~]# echo "UUID=0657c26979ed443aa4d3a70c15606e1c /user_data01  xfs  defaults,x-systemd.requires=stratis.service  0 0" >> /etc/fstab  
  2. [root@localhost ~]# echo "UUID=b91b970f23d94eb6b2ed56f347f770d2 /user_data02  xfs  defaults,x-systemd.requires=stratis.service  0 0" >> /etc/fstab 

檢查Stratis守護(hù)程序版本

如果需要檢查Stratis運(yùn)行的守護(hù)進(jìn)程版本,使用如下命令:

  1. [root@localhost ~]# stratis daemon version  
  2. 2.1.0 

向Stratis池中添加其他磁盤

在Stratis管理下,將新的塊設(shè)備添加到現(xiàn)有池非常容易。在上一篇文章《在Centos 中創(chuàng)建Stratis本地存儲(chǔ)(一)》設(shè)置中,“ data01_pool”中有4個(gè)磁盤,現(xiàn)在我們需要通過添加新磁盤來擴(kuò)展池中的空間。使用選項(xiàng)add-data來添加新磁盤,下面向"data01_pool"池中添加"/dev/sde"磁盤。

  1. [root@localhost ~]# stratis pool list  
  2. Name                       Total Physical   Properties 
  3. data01_pool   8 GiB / 1.11 GiB / 6.89 GiB      ~Ca,~Cr 
  4. [root@localhost ~]# stratis pool add-data data01_pool /dev/sde  
  5. [root@localhost ~]# stratis pool list  
  6. Name                        Total Physical   Properties 
  7. data01_pool   10 GiB / 1.12 GiB / 8.88 GiB      ~Ca,~Cr 

可以看到上圖中擴(kuò)展前是8G,擴(kuò)展之后變成了10G。再查看一下stratis的塊設(shè)備:

  1. [root@localhost ~]# stratis pool list  
  2. Name                       Total Physical   Properties 
  3. data01_pool   8 GiB / 1.11 GiB / 6.89 GiB      ~Ca,~Cr 
  4. [root@localhost ~]# stratis pool add-data data01_pool /dev/sde  
  5. [root@localhost ~]# stratis pool list  
  6. Name                        Total Physical   Properties 
  7. data01_pool   10 GiB / 1.12 GiB / 8.88 GiB      ~Ca,~Cr 

重命名池和文件系統(tǒng)

Stratis具有在運(yùn)行中重命名池或文件系統(tǒng)的功能,而不會(huì)影響任何正在運(yùn)行的設(shè)置。下面讓我們將當(dāng)前池名稱“data01_pool”重命名為“data01_pool_old”。

  1. [root@localhost ~]# stratis pool rename data01_pool date01_pool_old 

下面我們來重命名文件系統(tǒng),重命名文件系統(tǒng)類似于重命名池:

  1. [root@localhost ~]# stratis fs rename date01_pool_old user_data01 sys_data01 

在Stratis中創(chuàng)建快照

Stratis可以對(duì)任何文件系統(tǒng)進(jìn)行快照。讓我們對(duì)服務(wù)器中現(xiàn)有文件系統(tǒng)進(jìn)行快照。下面先再user_data01中寫入一些數(shù)據(jù):

  1. [root@localhost ~]# touch /user_data01/file{1..100}.txt 

下面來打快照:

  1. [root@localhost ~]# stratis fs snapshot date01_pool_old sys_data01 sys_data01_snap 

可以看到快照已生成。下面掛載/stratis/data01_pool_old/sys_data01_snap這個(gè)快照到/mnt目錄,然后查看文件是否存在。

  1. [root@localhost ~]# mount /stratis/date01_pool_old/sys_data01_snap /mnt/ 

刪除Stratis文件系統(tǒng)

刪除Stratis文件系統(tǒng)之前,需要在/etc/fstab中刪除stratis相關(guān)的那兩個(gè)文件系統(tǒng)條目。下面我只注釋掉,沒有刪除條目。

卸載文件系統(tǒng):

  1. [root@localhost ~]# umount /user_data01  
  2. [root@localhost ~]# umount /user_data02 

下面就開始刪除文件系統(tǒng)啦:

  1. [root@localhost ~]# stratis fs destroy date01_pool_old sys_data01 
  2. [root@localhost ~]# stratis fs destroy date01_pool_old user_data02 
  3. [root@localhost ~]# stratis fs destroy date01_pool_old sys_data01_snap  
  4. [root@localhost ~]# stratis fs destroy date01_pool_old user_data02_snap 

刪除Stratis池

要?jiǎng)h除Stratis池,我們應(yīng)該刪除在其下創(chuàng)建的所有文件系統(tǒng)。否則會(huì)提示:

  1. [root@localhost ~]# stratis pool destroy data01_pool_old  
  2. Execution failure caused by
  3. BUSY: filesystems remaining on pool 

下面來刪除池:

  1. [root@localhost ~]# stratis pool destroy date01_pool_old  
  2. [root@localhost ~]# stratis pool  
  3. Name   Total Physical   Properties 

總結(jié)

Stratis是RHEL8/Centos8中提供的一個(gè)新的本地存儲(chǔ)管理工具,它將有助于在塊設(shè)備上創(chuàng)建分層存儲(chǔ)。在RHEL8/Centos8中,可以通過安裝兩個(gè)軟件包獲得Stratis。我們已經(jīng)看到了如何通過添加磁盤并重命名來管理Stratis分層存儲(chǔ)。

本文轉(zhuǎn)載自微信公眾號(hào)「Linux就該這么學(xué)」,可以通過以下二維碼關(guān)注。轉(zhuǎn)載本文請(qǐng)聯(lián)系Linux就該這么學(xué)公眾號(hào)。

 

責(zé)任編輯:武曉燕 來源: Linux就該這么學(xué)
相關(guān)推薦

2018-06-11 12:53:53

LinuxStratis本地存儲(chǔ)

2018-06-19 16:05:27

LinuxStratis存儲(chǔ)

2018-03-26 14:25:55

KubernetesSkaffold命令

2010-01-13 13:04:25

minicom軟件

2021-04-28 16:41:26

Stratis磁盤加密系統(tǒng)運(yùn)維

2021-10-14 18:00:51

systemd系統(tǒng)管理員系統(tǒng)運(yùn)維

2022-04-30 09:41:14

LinuxNTP服務(wù)器

2013-11-20 15:32:13

紅帽RedHatYUM包

2009-06-25 16:49:24

Hibernate

2023-11-17 12:04:39

GORM并發(fā)

2013-12-13 17:21:14

Lua腳本語言

2023-04-12 15:25:09

Bytrace鴻蒙

2017-03-02 09:05:56

CentOS 7Sendmail郵件

2024-12-11 08:41:18

2021-03-17 11:21:06

React數(shù)據(jù)存儲(chǔ)

2021-10-13 14:06:46

MySQLUtf8符號(hào)

2009-03-17 15:51:41

數(shù)據(jù)庫存儲(chǔ)過程封裝

2020-12-15 18:56:26

MirantisDockersKubernetes

2011-06-15 10:08:01

Qt CVS

2010-04-29 17:51:40

Unix工具
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)