[root@serverc ~]# yum install vdo
Dependencies resolved.
==================================================================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================================================================
Installing:
vdo x86_64 6.2.5.74-14.el8 BaseOS 661 k
Installing dependencies:
kmod-kvdo x86_64 6.2.5.72-81.el8 BaseOS 339 k
python3-pyyaml x86_64 3.12-12.el8 BaseOS 192 k
...
3. VDO 創建以掛載
VDO 指定一個分割好的硬碟 ( 需大於 5G ),如尚未分割可以使用 parted 進行分割。
3.1. 分割硬碟
1
2
3
4
5
6
7
8
9
[root@serverc ~]# parted -s /dev/vdd mklabel msdos mkpart primary xfs 2048s 100% printModel: Virtio Block Device (virtblk)Disk /dev/vdd: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 10.7GB 10.7GB primary xfs lba
3.2. 創建 VDO
1
2
3
4
5
6
7
8
[root@serverc ~]# vdo create --name=vdo1 --device=/dev/vdd1 --vdoLogicalSize=10TCreating VDO vdo1
The VDO volume can address 6 GB in 3 data slabs, each 2 GB.
It can grow to address at most 16 TB of physical storage in 8192 slabs.
If a larger maximum size might be needed, use bigger slabs.
Starting VDO vdo1
Starting compression on VDO vdo1
VDO instance 1 volume is ready at /dev/mapper/vdo1
[root@serverc ~]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 10.0G 4.0G 6.0G 40% 99%
Note
就算沒有任何檔案, VDO 預設會保留 3 - 4G的空間做為緩衝。
4.2. 複製一個較大檔案至 /vdo 目錄並查看 VDO 狀態
1
2
3
4
5
[root@serverc ~]# ls -lh /usr/lib/locale/locale-archive
-rw-r--r--. 1 root root 208M Feb 16 12:49 /usr/lib/locale/locale-archive
[root@serverc ~]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 10.0G 4.1G 5.9G 40% 96%
4.3. 使用回圈多複製30個上述檔案,並查看 VDO 狀態
使用迴圈複製相同檔案多次,實際上只佔用一次檔案的空間,可以看出 saving% 比上一步驟增加了 4% ,不過 Used 還是維持 4.1 G。
1
2
3
4
[root@serverc ~]# for i in {1..30} ; do cp /usr/lib/locale/locale-archive /vdo/test${i}; done
[root@serverc ~]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 10.0G 4.1G 5.9G 41% 98%
[root@serverc ~]# parted -s /dev/vdd mklabel msdos mkpart primary xfs 2048s 100%[root@serverc ~]# vdo create --name=vdough --device=/dev/vdd1 --vdoLogicalSize=50GCreating VDO vdough
The VDO volume can address 6 GB in 3 data slabs, each 2 GB.
It can grow to address at most 16 TB of physical storage in 8192 slabs.
If a larger maximum size might be needed, use bigger slabs.
Starting VDO vdough
Starting compression on VDO vdough
VDO instance 0 volume is ready at /dev/mapper/vdough