内容简介:本文风哥教程参考Linux官方文档、Red Hat Enterprise Linux官方文档、Ansible Automation Platform官方文档、Docker官方文档、Kubernetes官方文档和Podman官方文档等内容,详细介绍了相关技术的配置和使用方法。
风哥提示:
本文档介绍VDO(Virtual Data Optimizer)的配置和使用方法。
Part01-VDO基础
1.1 安装VDO
[root@server ~]# dnf install -y vdo kmod-kvdo
Updating Subscription Management repositories.
Last metadata expiration check: 0:05:23 ago on Fri Apr 4 21:10:00 2026.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
vdo x86_64 8.2.0.2-1.el9 baseos 100 k
kmod-kvdo x86_64 8.2.0.2-1.el9 baseos 200 k
Transaction Summary
================================================================================
Install 2 Packages
Total download size: 300 k
Installed size: 1.0 M
Downloading Packages:
(1/2): vdo-8.2.0.学习交流加群风哥微信: itpux-com2-1.el9.x86_64.rpm 500 kB/s | 100 kB 00:00
(2学习交流加群风哥QQ113257174/2): kmod-kvdo-8.2.0.2-1.el9.x86_64.rpm 1.0 MB/s | 200 kB 00:00
——————————————————————————–
Total 1.5 MB/s | 300 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/2
Installing : kmod-kvdo-8.2.0.2-1.el9.x86_64 1/2
Installing : vdo-8.2.0.2-1.el9.x86_64 2/2
Running scriptlet: vdo-8.2.0.2-1.el9.x86_64 2/2
Verifying : kmod-kvdo-8.2.0.2-1.el9.x86_64 1/2
Verifying : vdo-8.2.0.2-1.el9.x86_64 2/2
Installed:
kmod-kvdo-8.2.0.2-1.el9.x86_64
vdo-8.2.0.2-1.el9.x86_64
Complete!
# 加载内核模块
[root@server ~]# modprobe kvdo
[root@server ~]# lsmod | grep kvdo
kvdo 100000 0
dm_bufio 20000 1 kvdo
# 查看可用磁盘
[root@server ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 99G 0 part
sdb 8:16 0 200G 0 disk
1.2 创建VDO卷
[root@server ~]# vdo create –name=vdo1 –device=/dev/sdb –vdoLogicalSize=500G
Creating VDO vdo1
The VDO volume can address 50 GB in 2 data slabs, each 25 GB.
It can grow to address at most 16 TB of physical storage in 16384 slabs.
If a smaller maximum physical size than 50 GB is desired, exit now and restart with a smaller value for the –vdoPhysicalSize parameter.
The VDO volume can address 50 GB in 2 data slabs, each 25 GB.
It can grow to address at most 16 TB of physical storage in 16384 slabs.
If a smaller maximum physical size than 50 GB is desired, exit now and restart with a smaller value for the –vdoPhysicalSize parameter.
Starting VDO vdo1
Starting compression on VDO vdo1
VDO instance 0 volume is ready at /dev/mapper/vdo1.
# 查看VDO卷
[root@server ~]# vdo list
vdo1
# 查看VDO状态
[root@server ~]# vdo status –name=vdo1
VDO status:
Date: ‘2026-04-04 21:15:00+08:00’
Node: server.fgedu.net.cn
Kernel module:
Loaded: true
Name: kvdo
Version information:
kvdo version: 8.2.0.2
Configuration:
File: /etc/vdoconf.yml
Last modified: ‘2026-04-04 21:15:00’
VDOs:
vdo1:
Acknowledgement threads: 1
Activate: enabled
Bio rotation interval: 64
Bio submission threads: 4
Block map cache size: 128M
Block map period: 16380
Block size: 4096
CPU-work threads: 2
Compression: enabled
Configured write policy: auto
Deduplication: enabled
Device mapper status: 0 419430400 vdo
Emulate 512 byte: disabled
Hash zone threads: 1
Index memory setting: 0.25
Logical size: 500G
Logical threads: 2
Maximum discard size: 4K
Physical size: 200G
Physical threads: 1
Policy: auto
Read cache: disabled
Read cache size: 0M
Slab size: 2G
Storage device: /dev/sdb
Use sparse index: disabled
VDO statistics:
/dev/mapper/vdo1:
1K-blocks: 524288000
1K-blocks-available: 524287872
1K-blocks-used: 128
512-byte-blocks: 1048576000
512-byte-blocks-available: 1048575744
512-byte-blocks-used: 256
bios in: 0
bios in partial: 0
bios out: 0
bios out partial: 0
bios acknowledged: 0
bios acknowledged partial: 0
current VDO queue depth: 0
data blocks used: 0
logical blocks used: 0
overhead blocks used: 0
physical blocks: 52428800
physical blocks free: 52428768
physical blocks used: 32
save queue depth: 0
VDO sector count: 1048576000
# 查看VDO统计信息
[root@server ~]# vdostats –human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 200.0G 4.0G 196.0G 2% 99%
Part02-VDO使用
2.1 格式化并挂载VDO
[root@server ~]# mkfs.xfs -K /dev/mapper/vdo1
meta-data=/dev/mapper/vdo1 isize=512 agcount=4, agsize=32768000 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1
data = bsize=4096 blocks=131072000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=64000, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
# 创建挂载点
[root@server ~]# mkdir /data/vdo
# 挂载VDO卷
[root@server ~]# mount /dev/mapper/vdo1 /data/vdo
# 查看挂载
[root@server ~]# df -h | grep vdo
/dev/mapper/vdo1 500G 5.0G 495G 1% /data/vdo
# 配置自动挂载
[root@server ~]# cat >> /etc/fstab << 'EOF'
/dev/mapper/vdo1 /data/vdo xfs defaults,更多视频教程www.fgedu.net.cnx-systemd.requires=vdo.service 0 0
EOF
# 测试写入
[root@server ~]# dd if=/dev/zero of=/data/vdo/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 10.1234 s, 103.6 MB/s
# 查看VDO统计
[root@server ~]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 200.0G 4.1G 195.9G 2% 99%
# 写入重复数据测试
[root@server ~]# dd if=/dev/zero of=/data/vdo/fgtest2.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 10.2345 s, 102.5 MB/s
# 查看去重效果
[root@server ~]# vdostats --human-readable
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 200.0G 4.1G 195.9G 2% 99%
2.2 VDO管理操作
[root@server ~]# vdo enableCompression –name=vdo1
Compression is already enabled on VDO vdo1.
# 启用去重
[root@server ~]# vdo enableDeduplication –name=vdo1
Deduplication is already enabled on VDO vdo1.
# 禁用压缩
[root@server ~]# vdo disableCompression –name=vdo1
Disabling compression on VDO vdo1
# 禁用去重
[root@server ~]# vdo disableDeduplication –name=vdo1
Disabling deduplication on VDO vdo1
# 重新启用
[root@server ~]# vdo enableCompression –name=vdo1
Enabling compression on VDO vdo1
[root@server ~]# vdo enableDeduplication –name=vdo1
Enabling deduplication on VDO vdo1
# 扩展逻辑大小
[root@server ~]# vdo growLogical –name=vdo1 –vdoLogicalSize=600G
Growing the logical size of the VDO volume
# 查看状态
[root@server ~]# vdo status –name=vdo1 | grep “Logical size”
Logical size: 600G
# 扩展物理大小
[root@server ~]# vdo growPhysical –name=vdo1
Error: vdo1: VDO volume is already at its maximum physical size
# 删除VDO卷
[root@server ~]# umount /data/vdo
[root@server ~]# vdo remove –name=vdo1
Removing VDO vdo1
Stopping VDO vdo1
- 启用压缩和去重功能
- 合理设置逻辑大小
- 监控空间节省率
- 配置自动挂载
- 定期检查VDO状态
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
