Compression allows you to reduce the size of a file. By decreasing use of the inodes table, it means more files and folders can be stored, maximizing the space available on physical storage. In Linux, system administrators have used tools such as zip, tar, gzip, bzip2, and other open source utilities for this task.
Red Hat Enterprise Linux (RHEL) 8 introduced the Virtual Data Optimizer (VDO). This system compresses data dynamically. VDO is integrated into Logical Volume Management (LVM) in RHEL 9, but in RHEL 8, it has its own special toolchain. I'll cover that in this article. In a future article, I'll look at using LVM2 to create VDO volumes on RHEL 9.
VDO uses two kernel modules, kvdo and uds, to implement a three-stage compression scheme:
- Zero-Block Elimination (or thin provisioning): First, it verifies a VDO device exists and can use the underlying physical storage as and when necessary. VDO locates all data blocks containing zero bytes and records this information in metadata. Non-zero blocks are passed on to the next phase.
- Deduplication: This phase ensures that multiple repeated copies of data are eliminated, leaving only distinct data blocks on disk.
- Compression: This last phase uses the
kvdokernel module to compress data blocks using the LZ4 compression algorithm.
Install VDO in RHEL 8
Install VDO in RHEL 8 by installing the relevant packages:
$ sudo yum install vdo kmod-kvdo -y
Enable VDO using the vdo command, which is a userspace command for interacting with VDO. To create a VDO volume called my_vdo, based on the physical disk /dev/sdb, with the logical space of 100 GB:
$ sudo vdo create --name=my_vdo \
--device=/dev/sdb --vdoLogicalSize=100G
Use VDO
The --vdoLogicalSize flag defines the size the VDO volume presents to users. It's usually larger than the actual physical storage. If left unspecified, by default, it has a 1:1 ratio to the physical storage.
To list the VDO volumes created on your system, use the list subcommand:
$ sudo vdo list
For details on a specific VDO, use the status subcommand:
$ sudo vdo status --name=my_vdo
[ Free download: Advanced Linux commands cheat sheet. ]
Next, format the VDO volume with the XFS filesystem (or the filesystem of your choice). You can also use LVM to manage the volume. Here is an mkfs example:
$ sudo mkfs.xfs -K /dev/mapper/my_vdo
Run udevadm to register the new device:
$ sudo udevadm settle
Finally, mount the volume using the mount command:
$ sudo mount /dev/mapper/my_vdo /mnt
Update the /etc/fstab file to set the mount options for the device:
$ sudo mount /dev/mapper/vdo_kvm /mnt
You can then update the /etc/fstab file for the new device with the mount options. In the example above, the /etc/fstab entry will be:
$ sudo vim /etc/fstab
/dev/mapper/vdo_kvm /mnt xfs defaults 0 0
[ Free eBook: Manage your Linux environment for success. ]
Use the vdostats command to display data deduplication and compression details on the mounted VDO filesystem:
$ sudo vdostats --human-readable
Better compression
With VDO, you don't have to compress files manually to conserve space. Instead, space is maximized by dynamic compression as data is created and modified. If you don't have VDO enabled on your RHEL 8 system, give it a try! If you're using RHEL 9 already, stay tuned for my next article.
저자 소개
I work as Unix/Linux Administrator with a passion for high availability systems and clusters. I am a student of performance and optimization of systems and DevOps. I have passion for anything IT related and most importantly automation, high availability, and security.
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래