VDO 란?

VDO(Virtual Data Optimizer)는 데이터의 중복제거, 압축 등의 기능을 사용해 스토리지의 공간 활용도를 높이는 기술입니다.

VDO 활용


위와 같이 다양한 분야에서 사용이 가능합니다.

VDO 장단점

  • 장점 : 중복 제거 및 압축 기능을 이용하여 스토리지 공간 활용도가 높아지며, 주로 VM 및 컨테이너 환경에서 높은 효율을 보인다고 합니다.
  • 단점 : 일반적인 스토리지에 비해 성능 저하가 발생합니다.
  • 참고 자료 : https://www.redhat.com/en/blog/look-vdo-new-linux-compression-layer

VDO 설치

  • 설치 환경 : CentOS 8.1

아래 명령을 통해 설치를 진행합니다.

[root@fastvm-centos-8-1-30 ~]# dnf install vdo kmod-kvdo
...

설치가 완료된 이후, 서비스를 시작합니다.

[root@fastvm-centos-8-1-30 ~]# systemctl enable --now vdo
[root@fastvm-centos-8-1-30 ~]# systemctl status vdo
● vdo.service - VDO volume services
   Loaded: loaded (/usr/lib/systemd/system/vdo.service; enabled; vendor preset: enabled)
   Active: active (exited) since Fri 2021-03-19 11:25:01 KST; 3min 21s ago
  Process: 875 ExecStart=/usr/bin/vdo start --all --confFile /etc/vdoconf.yml (code=exited, status=0/SUCCESS)
 Main PID: 875 (code=exited, status=0/SUCCESS)

Mar 19 11:24:58 fastvm-centos-8-1-30 systemd[1]: Starting VDO volume services...
Mar 19 11:25:01 fastvm-centos-8-1-30 systemd[1]: Started VDO volume services.

VDO Volume 생성

아래와 같이 VDO Device 를 생성할 수 있습니다.

[root@fastvm-centos-8-1-30 ~]# vdo create --device /dev/sda3 --vdoLogicalSize 200G --name vdo1
Creating VDO vdo1
      The VDO volume can address 90 GB in 45 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

VDO 파일시스템 생성

생성된 VDO Device 를 LVM 을 이용하여 LV 로 만들고 filesystem 을 생성하도록 하겠습니다.

# pvcreate /dev/mapper/vdo1
# vgcreate testvg /dev/mapper/vdo1
# lvcreate -l 100%FREE -n testlv testvg
# mkfs.xfs /dev/testvg/testlv

/etc/fstab 등록

향후 시스템 재부팅 간 자동으로 Mount 되도록 /etc/fstab 에 등록합니다.

/dev/testvg/testlv /mnt/testlv xfs defaults,_netdev,x-systemd.device-timeout=0,x-systemd.requires=vdo.service 0 0

중복 제거 및 압축 설정 확인

아래 명령을 통해 확인이 가능합니다.

[root@fastvm-centos-8-1-30 testlv]# vdo status | egrep 'Deduplication|Compression'
    Compression: enabled
    Deduplication: enabled

중복 제거 테스트

아래 명령을 통해 5GB 의 테스트 파일을 생성합니다.

[root@fastvm-centos-8-1-30 testlv]# dd if=/dev/urandom of=dd.file1 count=1024 bs=1024k
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 13.1108 s, 81.9 MB/s
[root@fastvm-centos-8-1-30 testlv]# dd if=/dev/urandom of=dd.file2 count=1024 bs=1024k
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 14.5352 s, 73.9 MB/s
[root@fastvm-centos-8-1-30 testlv]# dd if=/dev/urandom of=dd.file3 count=1024 bs=1024k
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 16.0602 s, 66.9 MB/s
[root@fastvm-centos-8-1-30 testlv]# dd if=/dev/urandom of=dd.file4 count=1024 bs=1024k
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 17.0693 s, 62.9 MB/s
[root@fastvm-centos-8-1-30 testlv]# dd if=/dev/urandom of=dd.file5 count=1024 bs=1024k
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 17.0444 s, 63.0 MB/s

VDO 사용량은 아래와 같이 변화가 생겼습니다.

"데이터 생성 이전"
[root@fastvm-centos-8-1-30 ~]# vdostats --hu
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1         94.0G      4.1G     89.9G   4%           N/A

"데이터 생성 이후"
[root@fastvm-centos-8-1-30 testlv]# vdostats --hu
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1         94.0G      9.1G     84.9G   9%            1%

생성된 파일을 cp 하여 파일시스템 사용률을 높이도록 하겠습니다.

[root@fastvm-centos-8-1-30 testlv]# for i in {1..400}; do cp -v dd.file1 cp.file$i;  done
'dd.file1' -> 'cp.file1'
'dd.file1' -> 'cp.file2'
...
'dd.file1' -> 'cp.file100'
...

아래와 같이 중복 제거가 되면서 스토리지 공간 Saving 을 하는 것을 확인 할 수 있습니다.

[root@fastvm-centos-8-1-30 testlv]# df -h /mnt/testlv 
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/testvg-testlv  200G   47G  154G  24% /mnt/testlv               <<

[root@fastvm-centos-8-1-30 testlv]# vdostats --hu
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1         94.0G      9.1G     84.9G   9%           88%      <<

VDO 스토리지 공간 Full 테스트

중복 제거가 불가능한 데이터를 넣으면 VDO 가 어떻게 동작하는지 테스트 해보았습니다.

[root@fastvm-centos-8-1-30 /]# cat /var/log/messages  | grep lvm | grep full
Mar 31 15:59:37 fastvm-centos-8-1-30 lvm[1622]: WARNING: VDO pool vdo1 is now 80.33% full.
Mar 31 16:01:37 fastvm-centos-8-1-30 lvm[1622]: WARNING: VDO pool vdo1 is now 85.04% full.
Mar 31 16:03:37 fastvm-centos-8-1-30 lvm[1622]: WARNING: VDO pool vdo1 is now 90.14% full.
Mar 31 16:05:27 fastvm-centos-8-1-30 lvm[1622]: WARNING: VDO pool vdo1 is now 95.03% full.
Mar 31 16:07:27 fastvm-centos-8-1-30 lvm[1622]: WARNING: VDO pool vdo1 is now 100.00% full.

먼저 위와 같이 /var/log/messages 에서 error message 가 발생합니다.

[root@fastvm-centos-8-1-30 /]# vdostats --hu
Device                    Size      Used Available Use% Space saving%
/dev/mapper/vdo1         94.0G     94.0G      0.0B 100%            0%
...
dd: failed to open 'dd.file143': Input/output error
dd: failed to open 'dd.file144': Input/output error
dd: failed to open 'dd.file145': Input/output error
dd: failed to open 'dd.file146': Input/output error
dd: failed to open 'dd.file147': Input/output error
dd: failed to open 'dd.file148': Input/output error
dd: failed to open 'dd.file149': Input/output error
dd: failed to open 'dd.file150': Input/output error
...

위와 같이 VDO 의 Used 는 100% 가 되고 해당 filesystem 은 데이터 생성이 불가능합니다.

참고 자료

chhanz's profile image

chhanz

2021-03-31

Read more posts by this author