Skip to content

Latest commit

 

History

History
122 lines (95 loc) · 4.38 KB

RH134-08-VDO.md

File metadata and controls

122 lines (95 loc) · 4.38 KB

Chapter 08 VDO

返回

VDO 简介

VDO 全称为虚拟数据优化器 Virtual Data Optimize,可以优化块设备上数据的空间占用,最大限度的减少数据的重复。包含两个模块

  • kvdo 用于控制数据压缩
  • uds 用于重复数据删除

安装 VDO 服务

# 安装 VDO
yum install vdo kmod-kvdo

[root@server130 ~]# yum list *vdo*
appstream                                                                                                            88 kB/s | 3.2 kB     00:00
baseos                                                                                                              117 kB/s | 2.8 kB     00:00
已安装的软件包
kmod-kvdo.x86_64                                                            6.2.4.26-77.el8                                                @anaconda
vdo.x86_64                                                                  6.2.4.14-14.el8                                                @anaconda
可安装的软件包
alsa-plugins-vdownmix.i686                                                  1.1.9-1.el8                                                    appstream
alsa-plugins-vdownmix.x86_64                                                1.1.9-1.el8                                                    appstream
libblockdev-vdo.i686                                                        2.24-5.el8                                                     appstream
libblockdev-vdo.x86_64                                                      2.24-5.el8                                                     appstream
vdo-support.x86_64                                                          6.2.4.14-14.el8                                                baseos

# 查看 VDO 是否启用
[root@server130 ~]# systemctl is-active vdo.service
active

创建 VDO 卷

创建成功之后,通过访问 /dev/mapper/vdo1 来使用 /dev/sdb 设备。

如果省略逻辑大小,则大小将与物理卷大小相同。

[root@server130 ~]# vdo create --name=vdo1 --device=/dev/sdb --vdoLogicalSize=50G
Creating VDO vdo1
      The VDO volume can address 16 GB in 8 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 0 volume is ready at /dev/mapper/vdo1

添加文件系统

mkfs.xfs -K /dev/mapper/vdo1

# 快速格式化
[root@server130 ~]# mkfs -t xfs -K /dev/mapper/vdo1
meta-data=/dev/mapper/vdo1       isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=6400, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

将 VDO 卷挂载到系统目录下

[root@server130 ~]# mkdir /vdo1
[root@server130 ~]# mount /dev/mapper/vdo1 /vdo1/
[root@server130 ~]# df -hT | grep vdo
/dev/mapper/vdo1 xfs        50G  390M   50G    1% /vdo1

自动挂载

/etc/fstab 添加如下的条目

/dev/mapper/vdo1	/vdo1	xfs	defaults,_netdev	0	0

查看 VDO 卷

# 查看 VDO 设备使用情况
[root@server130 ~]# vdostats --hu
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1         20.0G      4.0G     16.0G  20%           99%

# 以 YAML 格式显示 VDO 的系统报告
[root@server130 ~]# vdo status --name=vdo1
VDO status:
  Date: '2023-11-09 22:24:01+08:00'
  Node: server130.rhce.net
  ...

删除 VDO 卷

[root@server130 ~]# umount /vdo1
[root@server130 ~]# vdo remove -n vdo1
Removing VDO vdo1
Stopping VDO vdo1