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
kvdo
kernel 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.
About the author
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.
Browse by channel
Automation
The latest on IT automation for tech, teams, and environments
Artificial intelligence
Updates on the platforms that free customers to run AI workloads anywhere
Open hybrid cloud
Explore how we build a more flexible future with hybrid cloud
Security
The latest on how we reduce risks across environments and technologies
Edge computing
Updates on the platforms that simplify operations at the edge
Infrastructure
The latest on the world’s leading enterprise Linux platform
Applications
Inside our solutions to the toughest application challenges
Original shows
Entertaining stories from the makers and leaders in enterprise tech
Products
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Cloud services
- See all products
Tools
- Training and certification
- My account
- Customer support
- Developer resources
- Find a partner
- Red Hat Ecosystem Catalog
- Red Hat value calculator
- Documentation
Try, buy, & sell
Communicate
About Red Hat
We’re the world’s leading provider of enterprise open source solutions—including Linux, cloud, container, and Kubernetes. We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Select a language
Red Hat legal and privacy links
- About Red Hat
- Jobs
- Events
- Locations
- Contact Red Hat
- Red Hat Blog
- Diversity, equity, and inclusion
- Cool Stuff Store
- Red Hat Summit