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

Centos8 中安裝并配置 VDO 來(lái)優(yōu)化存儲(chǔ)空間

云計(jì)算 虛擬化
虛擬數(shù)據(jù)優(yōu)化器(VDO)是一種塊虛擬化技術(shù),可提供透明的數(shù)據(jù)重復(fù)刪除功能。通過(guò)消除冗余的數(shù)據(jù)塊,VDO可以大大減少實(shí)際使用的磁盤(pán)容量。

[[400325]]

虛擬數(shù)據(jù)優(yōu)化器(VDO)是一種塊虛擬化技術(shù),可提供透明的數(shù)據(jù)重復(fù)刪除功能。通過(guò)消除冗余的數(shù)據(jù)塊,VDO可以大大減少實(shí)際使用的磁盤(pán)容量。

VDO由兩個(gè)內(nèi)核模塊和兩個(gè)命令組成:

由下面兩個(gè)內(nèi)核模塊組成:

  • kvdo - 該模塊加載到設(shè)備管理器層,提供用于重復(fù)數(shù)據(jù)刪除的塊存儲(chǔ)卷。
  • uds - 該模塊負(fù)責(zé)與VDO磁盤(pán)上的通用的重復(fù)數(shù)據(jù)刪除索引進(jìn)行通信。

包括兩個(gè)命令行工具:

  • vdo - 用于創(chuàng)建,刪除,啟動(dòng)和停止VDO卷,以及執(zhí)行其他配置操作。
  • vdostats - 用于報(bào)告VDO卷的各個(gè)方面,包括有效的減少和物理卷的利用率。

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

Centos8

安裝VDO

下面命令安裝vdo和相關(guān)依賴(lài),安裝完成之后重啟系統(tǒng):

  1. [root@localhost ~]# yum -y install vdo 
  2. [root@localhost ~]# reboot 

創(chuàng)建一個(gè)VDO設(shè)備

確保有一個(gè)空余磁盤(pán)或分區(qū)可供VDO使用。盡管可以在LVM邏輯卷上面創(chuàng)建VDO卷,但是重新引導(dǎo)系統(tǒng)時(shí)會(huì)出現(xiàn)引導(dǎo)順序問(wèn)題。所以再裸盤(pán)上面創(chuàng)建vdo卷之后在它之上創(chuàng)建LVM邏輯卷。

下面使用一塊20GB的磁盤(pán),/dev/sda做vdo卷

下面創(chuàng)建vdo卷:

  1. [root@localhost ~]# vdo create --name=vdolvm --device /dev/sda --vdoLogicalSize 60G --writePolicy async  
  2. Creating VDO vdolvm 
  3.       The VDO volume can address 16 GB in 8 data slabs, each 2 GB. 
  4.       It can grow to address at most 16 TB of physical storage in 8192 slabs. 
  5.       If a larger maximum size might be needed, use bigger slabs. 
  6. Starting VDO vdolvm 
  7. Starting compression on VDO vdolvm 
  8. VDO instance 0 volume is ready at /dev/mapper/vdolvm 

下面分解一下命令,看看所使用的選項(xiàng):

--device - 指定在哪個(gè)硬盤(pán)上創(chuàng)建vdo卷

--vdoLogicalSize - 這里我們指定了容量大小為60G,比我們實(shí)際磁盤(pán)20G大了許多。假設(shè)我們將從重復(fù)數(shù)據(jù)刪除中至少得到3:1的減少,對(duì)于大多數(shù)的數(shù)據(jù),這是相當(dāng)保守的,但如果你的數(shù)據(jù)沒(méi)有很多重復(fù)的,那么比率應(yīng)該是不同的。日志文件和其他純文本文件通??梢院芎玫剡M(jìn)行重復(fù)數(shù)據(jù)刪除,可能會(huì)得到10:1甚至更高的重復(fù)數(shù)據(jù)刪除率。但是二進(jìn)制文件,如視頻、音頻或壓縮包,將遠(yuǎn)遠(yuǎn)低于3:1,甚至在某些情況下1:1。這種情況下不建議使用vdo卷。

--writePolicy - vdo有三種寫(xiě)策略:

sync:只有在數(shù)據(jù)寫(xiě)入物理設(shè)備后,才會(huì)確認(rèn)對(duì)VDO卷的寫(xiě)入。

async:在數(shù)據(jù)寫(xiě)入緩存后被確認(rèn)。如果在設(shè)備故障或掉電之前沒(méi)有刷新緩存,可能會(huì)導(dǎo)致數(shù)據(jù)丟失。

auto:在這種默認(rèn)模式下,VDO將檢查存儲(chǔ)設(shè)備并確定它是否支持刷新。如果是這樣,VDO將使用異步模式。如果沒(méi)有,它將使用同步模式。

查看新建VDO卷相關(guān)的信息

正如我們?cè)谏弦徊降妮敵鲋锌吹降模琕DO創(chuàng)建了一個(gè)名為/dev/mapper/vdolvm的新dm設(shè)備。當(dāng)我們創(chuàng)建lvm卷組時(shí),這就是我們將要使用的設(shè)備。

  1. [root@localhost ~]# ll /dev/mapper/vdolvm  
  2. lrwxrwxrwx 1 root root 7 Mar  4 13:31 /dev/mapper/vdolvm -> ../dm-2 

讓我們看看使用vdostats可以獲得有關(guān)vdo卷的什么樣的信息:

  1. [root@localhost ~]# vdostats --hu 
  2. Device                    Size      Used Available Use% Space saving% 
  3. /dev/mapper/vdolvm       20.0G      4.0G     16.0G  20%           N/A 

由于我們尚未將任何數(shù)據(jù)寫(xiě)入該卷,因此Space saving%字段為N/A。稍后我們將寫(xiě)一些數(shù)據(jù)時(shí),在此處看到更多有用的信息。

可以看到上圖中,我們還沒(méi)有寫(xiě)任何數(shù)據(jù),但是已經(jīng)有4GB,20%的空間正在使用中了!這是因?yàn)?ldquo;通用重復(fù)數(shù)據(jù)刪除索引”已被寫(xiě)入磁盤(pán)。這基本上是一個(gè)數(shù)據(jù)庫(kù),用于記錄slab指紋及其位置。這就是使重復(fù)數(shù)據(jù)刪除成為可能的原因。

將VDO卷作為普通磁盤(pán)設(shè)備進(jìn)行設(shè)置

現(xiàn)在我們已經(jīng)創(chuàng)建了VDO設(shè)備,我們可以對(duì)其進(jìn)行分區(qū)并格式化,或者在這個(gè)vod卷上面創(chuàng)建lvm邏輯卷。下面我們創(chuàng)建邏輯卷:

  1. # 創(chuàng)建物理卷 
  2. [root@localhost ~]# pvcreate /dev/mapper/vdolvm  
  3.   Physical volume "/dev/mapper/vdolvm" successfully created. 
  4. # 創(chuàng)建卷組vdo_vg 
  5. [root@localhost ~]# vgcreate vdo_vg /dev/mapper/vdolvm  
  6.   Volume group "vdo_vg" successfully created 
  7. # 查看vdo_vg卷組的信息 
  8. [root@localhost ~]# vgdisplay vdo_vg  
  9.   --- Volume group --- 
  10.   VG Name               vdo_vg 
  11.   System ID              
  12.   Format                lvm2 
  13.   Metadata Areas        1 
  14.   Metadata Sequence No  1 
  15.   VG Access             read/write 
  16.   VG Status             resizable 
  17.   MAX LV                0 
  18.   Cur LV                0 
  19.   Open LV               0 
  20.   Max PV                0 
  21.   Cur PV                1 
  22.   Act PV                1 
  23.   VG Size               <60.00 GiB 
  24.   PE Size               4.00 MiB 
  25.   Total PE              15359 
  26.   Alloc PE / Size       0 / 0    
  27.   Free  PE / Size       15359 / <60.00 GiB 
  28.   VG UUID               qfPiH6-eMCU-Z6kr-eeCu-jd0J-8lmf-49daZX 

從上面可以看到,lvm認(rèn)為我們的基礎(chǔ)磁盤(pán)為120GB,盡管我們知道它只有40GB。由于LVM不知道VDO后端磁盤(pán)的大小。

現(xiàn)在,讓我們創(chuàng)建幾個(gè)邏輯卷吧:

  1. [root@localhost ~]# lvcreate -n vdo_lv01 -L 15G vdo_vg  
  2. [root@localhost ~]# lvcreate -L 15G -n vdo_lv02 vdo_vg 
  3. [root@localhost ~]# lvcreate -L 15G -n vdo_lv03 vdo_vg  
  4. # 查看創(chuàng)建好的邏輯卷 
  5. [root@localhost ~]# lvs -o +devices 

創(chuàng)建掛載點(diǎn)并掛載文件系統(tǒng)

通常,創(chuàng)建文件系統(tǒng)后,它將在設(shè)備上運(yùn)行Trim操作。使用VDO時(shí),這不是理想的選擇,因?yàn)榇疟P(pán)容量是按需分配的。因此,我們要告訴mkfs在文件系統(tǒng)創(chuàng)建過(guò)程中不要丟棄塊。對(duì)于XFS,請(qǐng)使用-K選項(xiàng)。對(duì)于EXT4,請(qǐng)使用-E nodiscard。下面使用了一個(gè)for循環(huán),將三個(gè)邏輯卷格式化為XFS文件系統(tǒng):

  1. [root@localhost ~]# for i in `seq 1 3`; do mkfs.xfs -K /dev/vdo_vg/vdo_lv0$i ; done 
  2. meta-data=/dev/vdo_vg/vdo_lv01   isize=512    agcount=4, agsize=983040 blks 
  3.          =                       sectsz=4096  attr=2, projid32bit=1 
  4.          =                       crc=1        finobt=1, sparse=1, rmapbt=0 
  5.          =                       reflink=1 
  6. data     =                       bsize=4096   blocks=3932160, imaxpct=25 
  7.          =                       sunit=0      swidth=0 blks 
  8. naming   =version 2              bsize=4096   ascii-ci=0, ftype=1 
  9. log      =internal log           bsize=4096   blocks=2560, version=2 
  10.          =                       sectsz=4096  sunit=1 blks, lazy-count=1 
  11. realtime =none                   extsz=4096   blocks=0, rtextents=0 
  12. meta-data=/dev/vdo_vg/vdo_lv02   isize=512    agcount=4, agsize=983040 blks 
  13.          =                       sectsz=4096  attr=2, projid32bit=1 
  14.          =                       crc=1        finobt=1, sparse=1, rmapbt=0 
  15.          =                       reflink=1 
  16. data     =                       bsize=4096   blocks=3932160, imaxpct=25 
  17.          =                       sunit=0      swidth=0 blks 
  18. naming   =version 2              bsize=4096   ascii-ci=0, ftype=1 
  19. log      =internal log           bsize=4096   blocks=2560, version=2 
  20.          =                       sectsz=4096  sunit=1 blks, lazy-count=1 
  21. realtime =none                   extsz=4096   blocks=0, rtextents=0 
  22. meta-data=/dev/vdo_vg/vdo_lv03   isize=512    agcount=4, agsize=983040 blks 
  23.          =                       sectsz=4096  attr=2, projid32bit=1 
  24.          =                       crc=1        finobt=1, sparse=1, rmapbt=0 
  25.          =                       reflink=1 
  26. data     =                       bsize=4096   blocks=3932160, imaxpct=25 
  27.          =                       sunit=0      swidth=0 blks 
  28. naming   =version 2              bsize=4096   ascii-ci=0, ftype=1 
  29. log      =internal log           bsize=4096   blocks=2560, version=2 
  30.          =                       sectsz=4096  sunit=1 blks, lazy-count=1 
  31. realtime =none                   extsz=4096   blocks=0, rtextents=0 

當(dāng)我們將新文件系統(tǒng)掛載到掛載點(diǎn)時(shí),我們要告訴XFS放棄塊,因?yàn)檫@將大大加快文件刪除的速度。

  1. [root@localhost ~]# mkdir -p /data/{01..03} 
  2. [root@localhost ~]# for i in `seq 1 3`; do mount -o discard /dev/vdo_vg/vdo_lv0$i /data/0$i; done 

現(xiàn)在,我們向設(shè)備寫(xiě)入了少量數(shù)據(jù),我們可以再次檢查VDO卷以查看情況是否已更改。

  1. [root@localhost ~]# vdostats --hu 
  2. Device                    Size      Used Available Use% Space saving% 
  3. /dev/mapper/vdolvm       20.0G      4.0G     16.0G  20%           86% 

設(shè)置為開(kāi)機(jī)啟動(dòng)

下面將三個(gè)邏輯卷設(shè)置為開(kāi)機(jī)啟動(dòng),需要在fstab文件中添加x-systemd.device-timeout=0和x-systemd.requires=vdo.service。

使用blkid查看這三個(gè)邏輯卷的UUID。

使用上面獲取到的UUID,添加在/etc/fstab文件中:

  1. [root@localhost systemd]# vim /etc/fstab  
  2.  
  3. UUID="bd2c1c61-4656-4065-b5a0-3ca53ef0f949" /data/01  xfs  defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0 
  4. UUID="1e53579b-f1da-4f77-80e6-d61a40515525" /data/02  xfs  defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0 
  5. UUID="d41bf7e2-bf75-4db7-b323-a923375f6a6e" /data/03  xfs  defaults,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0 

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

 

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

2022-04-15 07:51:36

Centos8遷移邏輯卷

2012-11-06 09:31:12

2015-12-15 15:38:57

Windows 10存儲(chǔ)空間微軟

2019-10-28 14:38:36

RsyslogCentOS8開(kāi)源

2017-12-04 08:37:31

存儲(chǔ)空間NAS

2018-06-27 14:40:50

Windows 10Windows存儲(chǔ)空間

2019-04-26 15:38:34

Hadoop集群存儲(chǔ)

2022-07-19 07:41:09

Centos8操作系統(tǒng)Nginx進(jìn)程

2022-01-10 09:39:49

Centos根目錄權(quán)限

2013-03-04 09:55:18

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

2022-02-21 08:31:49

Centos8Caddy Web服務(wù)器

2021-07-07 07:09:51

Centos8 RescueSSH

2021-09-18 10:48:29

手機(jī)內(nèi)存微信

2020-12-09 08:04:27

Centos8root密碼

2022-03-11 09:47:17

Google手機(jī)空間應(yīng)用歸檔

2022-03-16 12:49:28

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

2018-08-15 15:50:03

Windows 10存儲(chǔ)空間應(yīng)用程序

2011-08-12 14:51:31

SQL ServerSET NOCOUNT

2020-04-27 14:17:00

iPhone SE蘋(píng)果存儲(chǔ)

2019-11-14 09:20:15

CentOS 8RHEL 8Nagios Core
點(diǎn)贊
收藏

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