日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Centos8中創(chuàng)建LVM的精簡邏輯卷具體方法

LVM的精簡邏輯卷,這可以創(chuàng)建大于可用盤區(qū)的邏輯卷。精簡池可以在需要時進(jìn)行動態(tài)擴(kuò)展,存儲管理員可以過量使用物理存儲,以節(jié)省成本地分配存儲空間,下面講解一下在Centos8中創(chuàng)建LVM的精簡邏輯卷具體方法。

創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的云安網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

系統(tǒng)環(huán)境

Centos8

創(chuàng)建精簡池

下面我們添加一塊硬盤。創(chuàng)建物理卷,然后創(chuàng)建卷組:

[root@localhost ~]# pvcreate /dev/sda
 Physical volume "/dev/sda" successfully created.
[root@localhost ~]# vgcreate vg_thin /dev/sda
 Volume group "vg_thin" successfully created
[root@localhost ~]# vgs
 VG      #PV #LV #SN Attr   VSize   VFree  
 cl        1   2   0 wz--n- 

上面已經(jīng)創(chuàng)建好一個新的卷組了,名字為vg_thin。然后在現(xiàn)有卷組的中創(chuàng)建一個精簡池:

[root@localhost ~]# lvcreate -L 1G -T vg_thin/thin_pool
 Thin pool volume with chunk size 64.00 KiB can address at most 15.81 TiB of data.
 Logical volume "thin_pool" created.
[root@localhost ~]# lvs
 LV        VG      Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
 root      cl      -wi-ao---- 15.00g                                                    
 swap      cl      -wi-ao----  2.00g                                                    
 thin_pool vg_thin twi-a-tz--  1.00g             0.00   10.94        

Centos8中創(chuàng)建LVM精簡邏輯卷Centos8中創(chuàng)建LVM精簡邏輯卷

創(chuàng)建精簡卷

創(chuàng)建精簡池之后,我們就可以從精簡池中創(chuàng)建精簡卷。在本實(shí)驗(yàn)中創(chuàng)建四個精簡卷,每個精簡卷的大小為200 MB。

[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user1
 Logical volume "tp_lv_user1" created.
[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user2
 Logical volume "tp_lv_user2" created.
[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user3
 Logical volume "tp_lv_user3" created.
[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user4
 Logical volume "tp_lv_user4" created.

Centos8中創(chuàng)建LVM精簡邏輯卷Centos8中創(chuàng)建LVM精簡邏輯卷

格式化并掛載精簡卷

將上面創(chuàng)建的四個精簡卷格式化為xfs格式:

[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user1
[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user2
[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user3
[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user4

創(chuàng)建掛載點(diǎn),并掛載:

[root@localhost ~]# mkdir -p /mnt/user{1..4}
[root@localhost ~]# mount /dev/vg_thin/tp_lv_user1 /mnt/user1
[root@localhost ~]# mount /dev/vg_thin/tp_lv_user2 /mnt/user2
[root@localhost ~]# mount /dev/vg_thin/tp_lv_user3 /mnt/user3
[root@localhost ~]# mount /dev/vg_thin/tp_lv_user4 /mnt/user4

向這四個目錄寫入一些文件:

[root@localhost ~]# dd if=/dev/zero of=/mnt/user1/test.img bs=1M count=100
[root@localhost ~]# dd if=/dev/zero of=/mnt/user2/test.img bs=1M count=100
[root@localhost ~]# dd if=/dev/zero of=/mnt/user3/test.img bs=1M count=100
[root@localhost ~]# dd if=/dev/zero of=/mnt/user4/test.img bs=1M count=100

然后運(yùn)行下面命令查看以下使用空間:

[root@localhost ~]# lvs

我們可以注意到精簡池利用率為41.41%

開啟防止精簡池空間耗盡的保護(hù)

再創(chuàng)建兩個200 MB的精簡卷??梢园l(fā)現(xiàn)創(chuàng)建這兩個精簡卷會超過所設(shè)置的精簡池的大小,雖然可以創(chuàng)建成功,但這樣做會有更大的風(fēng)險,并提示一些超額的警告。

[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user5
 Logical volume "tp_lv_user5" created.
[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user6
 WARNING: Sum of all thin volume sizes (1.17 GiB) exceeds the size of thin pool vg_thin/thin_pool (1.00 GiB).
 WARNING: You have not turned on protection against thin pools running out of space.
 WARNING: Set activation/thin_pool_autoextend_threshold below 100 to trigger automatic extension of thin pools before they get full.
 Logical volume "tp_lv_user6" created.

下面我們刪掉剛才創(chuàng)建的tp_lv_user5和tp_lv_user6,在lvm.conf配置文件中開啟超額保護(hù),并重新創(chuàng)建這兩個精簡卷:

[root@localhost ~]# lvremove -f /dev/vg_thin/tp_lv_user5 Logical volume "tp_lv_user5" successfully removed[root@localhost ~]# lvremove -f /dev/vg_thin/tp_lv_user6 Logical volume "tp_lv_user6" successfully removed

編輯/etc/lvm/lvm.conf配置文件,將下兩個參數(shù)的值修改一下:

# 當(dāng)精簡池的使用率超過此百分比時,將自動擴(kuò)展該池,將其更改為100將禁用自動擴(kuò)展??山邮艿淖钚≈凳?0。       thin_pool_autoextend_threshold = 80# 通過自動擴(kuò)展精簡池,會增加這個百分比的額外空間。添加到精簡池的額外空間量是其當(dāng)前大小的百分比。       thin_pool_autoextend_percent = 20

下面創(chuàng)建tp_lv_user5和tp_lv_user6兩個精簡卷:

[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user5 Logical volume "tp_lv_user5" created.[root@localhost ~]# lvcreate -V 200M -T vg_thin/thin_pool -n tp_lv_user6 Logical volume "tp_lv_user6" created.[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user5[root@localhost ~]# mkfs.xfs /dev/vg_thin/tp_lv_user6[root@localhost ~]# mkdir -p /mnt/user{5..6}[root@localhost ~]# mount /dev/vg_thin/tp_lv_user5 /mnt/user5[root@localhost ~]# mount /dev/vg_thin/tp_lv_user6 /mnt/user6

看一下使用的情況: 下面我們向/mnt/user5和/mnt/user6填充內(nèi)容,直到thin_pool精簡池的使用率超過80%,我們可以看到精簡池的容量擴(kuò)容了。

[root@localhost ~]# lvs LV          VG      Attr       LSize   Pool      Origin Data%  Meta%  Move Log Cpy%Sync Convert root        cl      -wi-ao----  15.00g                                                         swap        cl      -wi-ao----   2.00g                                                         thin_pool   vg_thin twi-aotz--   1.20g                  75.94  22.66                           tp_lv_user1 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                   tp_lv_user2 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                   tp_lv_user3 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                   tp_lv_user4 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                   tp_lv_user5 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                   tp_lv_user6 vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  

可以看到上面,thin_pool精簡池的容量提升了200M,這就說明當(dāng)精簡池的使用率超過80%時,提升20%的容量。

如何擴(kuò)展精簡池

擴(kuò)展精簡池時,我們需要遵循兩個步驟:

  • \1. 擴(kuò)展精簡池的元數(shù)據(jù)
  • \2. 然后再擴(kuò)展精簡池。

要擴(kuò)展精簡池,我們不應(yīng)該立即繼續(xù)擴(kuò)展精簡池。首先,通過運(yùn)行lvs -a查看現(xiàn)有元數(shù)據(jù)使用的大小情況。

[root@localhost ~]# lvs -a
 LV                VG      Attr       LSize   Pool      Origin Data%  Meta%  Move Log Cpy%Sync Convert
 root              cl      -wi-ao----  15.00g                                                        
 swap              cl      -wi-ao----   2.00g                                                        
 [lvol0_pmspare]   vg_thin ewi-------   4.00m                                                        
 thin_pool         vg_thin twi-aotz--   1.20g                  75.94  22.66                          
 [thin_pool_tdata] vg_thin Twi-ao----   1.20g                                                        
 [thin_pool_tmeta] vg_thin ewi-ao----   4.00m                                                        
 tp_lv_user1       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  
 tp_lv_user2       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  
 tp_lv_user3       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  
 tp_lv_user4       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  
 tp_lv_user5       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                                  
 tp_lv_user6       vg_thin Vwi-aotz-- 200.00m thin_pool        77.97                    

Centos8中創(chuàng)建LVM精簡邏輯卷Centos8中創(chuàng)建LVM精簡邏輯卷

擴(kuò)展精簡池metadata的大小

元數(shù)據(jù)的當(dāng)前大小僅為4 MB。讓我們在當(dāng)前大小的基礎(chǔ)上添加4MB。

[root@localhost ~]# lvextend --poolmetadatasize +4M vg_thin/thin_pool

可以看到[thin_pool_tmeta]已經(jīng)變成8M了。

擴(kuò)展精簡池的大小

完成擴(kuò)展元數(shù)據(jù)后,開始將精簡池擴(kuò)展到所需的大小。將精簡池擴(kuò)容量再添加1G容量。

[root@localhost ~]# lvextend -L +1G /dev/vg_thin/thin_pool

現(xiàn)在大小已變成2.2G了。

擴(kuò)展精簡卷

擴(kuò)展精簡卷和擴(kuò)展精簡池類似:

[root@localhost ~]# lvextend -L +200M /dev/vg_thin/tp_lv_user1

Centos8中創(chuàng)建LVM精簡邏輯卷Centos8中創(chuàng)建LVM精簡邏輯卷

刪除精簡卷、精簡池

要刪除精簡池,首先需要卸載所有文件系統(tǒng),然后刪除所有精簡卷,最后刪除精簡池。

# 卸載分區(qū)
[root@localhost ~]# umount /mnt/user{1..6}
# 刪除精簡卷
[root@localhost ~]# lvremove -y /dev/vg_thin/tp_lv_user[1-6]
 Logical volume "tp_lv_user1" successfully removed
 Logical volume "tp_lv_user2" successfully removed
 Logical volume "tp_lv_user3" successfully removed
 Logical volume "tp_lv_user4" successfully removed
 Logical volume "tp_lv_user5" successfully removed
 Logical volume "tp_lv_user6" successfully removed
# 刪除精簡池
[root@localhost ~]# lvremove -y /dev/vg_thin/thin_pool
 Logical volume "thin_pool" successfully removed

使用lvs 命令查看以下,是否已經(jīng)刪除干凈:

[root@localhost ~]# lvs -a
 LV   VG Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
 root cl -wi-ao---- 15.00g                                                    
 swap cl -wi-ao----  2.00g                

Centos8中創(chuàng)建LVM精簡邏輯卷Centos8中創(chuàng)建LVM精簡邏輯卷

總結(jié)

精簡卷是可以創(chuàng)建大于可用磁盤的邏輯卷。使用精簡卷,你可以管理可用空間的存儲池(稱為精簡池),可以在應(yīng)用程序需要時將其分配給任意數(shù)量的設(shè)備。精簡池可以在需要時進(jìn)行動態(tài)擴(kuò)展,以節(jié)省成本。


分享名稱:Centos8中創(chuàng)建LVM的精簡邏輯卷具體方法
本文鏈接:http://www.5511xx.com/article/cojggpc.html