Comparing Storage Optimization Solutions on Linux
Storage shortages are a constant challenge when managing storage servers, backup servers, or KVM virtualization clusters. To thoroughly address this issue at the block and filesystem levels, sysadmins typically consider three main approaches:
- ZFS (ZFS on Linux): ZFS offers extremely powerful compression and deduplication mechanisms. However, it is not included in the mainline RHEL/CentOS kernel due to licensing conflicts (CDDL vs GPL), requiring you to build out-of-tree modules via DKMS. The biggest downside is that ZFS is notoriously memory-hungry, typically demanding 1 GB to 5 GB of RAM per 1 TB of storage when deduplication is enabled.
- Btrfs: Transparent compression (zstd, lzo) runs very smoothly. However, deduplication on Btrfs does not operate inline in real time; it requires offline batch scans using external tools like
duperemove. Furthermore, Red Hat dropped official support for Btrfs in Enterprise Linux years ago. - Virtual Data Optimizer (VDO): Red Hat’s native solution embedded directly into the Linux kernel. VDO acts as a virtual block device that automatically performs zero-block elimination, inline deduplication via a UDS index, and data compression using the LZ4 algorithm right before writing to physical disk.
Quick Comparison Table
The summary table below helps you choose the right solution for your infrastructure:
| Criteria | ZFS on Linux | Btrfs (Offline Dedup) | LVM-VDO (CentOS Stream 9) |
|---|---|---|---|
| Deduplication | Inline, high RAM usage | Offline (scheduled batch scan) | Inline (UDS index, low RAM usage) |
| Data Compression | Inline (LZ4, ZSTD) | Inline (ZLIB, ZSTD, LZO) | Inline (LZ4 via CPU) |
| RHEL/CentOS Kernel Compatibility | Requires third-party repo | Not officially supported | Native support, built into LVM2 |
| Resource Overhead | Very high (RAM & CPU) | Spikes during scan jobs | Moderate, configurable RAM for UDS |
Why LVM-VDO Is the Top Choice on CentOS Stream 9
Previously on CentOS 7 and 8, VDO operated as a standalone daemon managed via the vdo and vdomgr commands. Starting with RHEL 9 and CentOS Stream 9, Red Hat completely changed the game by deprecating the standalone management package and integrating VDO directly into the LVM2 (LVM-VDO) toolset.
This change delivers three major advantages:
- Familiar Management: You can reuse standard LVM commands like
lvcreate,lvextend, andlvswithout needing to learn any new CLI tools. - Flexible Thin Provisioning: You can easily overcommit logical capacity to 3x–5x the physical storage based on your estimated compression and dedup ratios.
- Highly Effective for VMs and Backups: Repositories containing VM templates (qcow2/raw) or daily backup directories often share 60% to 85% duplicate data. With VDO, 500 GB of backups may only take up around 120 GB of actual physical disk space.
Step-by-Step Guide to Configuring LVM-VDO
Assume your server has a new disk attached at /dev/sdb with 50 GB of physical capacity. Our goal is to create a 150 GB virtual volume for data storage.
Step 1: Install Required Packages and Load the Kernel Module
Install the LVM packages and VDO driver directly from the default CentOS 9 repositories:
sudo dnf install -y lvm2 kmod-kvdo vdo
# Load the kvdo kernel module
sudo modprobe kvdo
lsmod | grep kvdo
Step 2: Initialize Physical Volume and Volume Group
Create a Physical Volume on /dev/sdb and assign it to a Volume Group named vg_storage:
# Initialize PV
sudo pvcreate /dev/sdb
# Initialize VG
sudo vgcreate vg_storage /dev/sdb
Step 3: Create the VDO Pool and Logical Volume
Use the lvcreate command with the --type vdo option. For example, allocate 40 GB of physical storage for the dedup/compression pool while provisioning a 150 GB virtual size for the system:
sudo lvcreate --type vdo \
-n vdo_volume \
-L 40G \
-V 150G \
--vdo-pool vdo_pool \
vg_storage
Key parameter breakdown:
-L 40G: The actual physical storage allocated from the Volume Group for data and index tables.-V 150G: The virtual size presented to the operating system.--vdo-pool vdo_pool: The underlying pool name responsible for compression and deduplication.-n vdo_volume: The resulting Logical Volume used to format the filesystem.
Step 4: Format the Filesystem and Mount
Format the volume with XFS. Make sure to include the -K flag to skip discarding unused blocks (TRIM), enabling instant formatting without bloating metadata:
# Format XFS filesystem with the -K option
sudo mkfs.xfs -K /dev/vg_storage/vdo_volume
# Create mount point and perform a test mount
sudo mkdir -p /data_vdo
sudo mount /dev/vg_storage/vdo_volume /data_vdo
To enable automatic mounting on boot, append the following line to /etc/fstab:
echo '/dev/vg_storage/vdo_volume /data_vdo xfs defaults 0 0' | sudo tee -a /etc/fstab
Step 5: Verify Compression and Deduplication Efficiency
To check storage savings, use the vdostats utility:
sudo vdostats --human-readable
Sample output after copying 5 cloned Ubuntu 22.04 VM images (10 GB each):
Device Size Used Available Use% Space saving%
vg_storage-vdo_pool-vpool 40.0G 9.8G 30.2G 24% 79%
While the total uncompressed source data written was 50 GB, the actual physical space occupied is under 10 GB, achieving a storage savings rate (Space saving%) of nearly 80%.
Operational Tips and Best Practices
- Always Monitor Physical Capacity: Overprovisioning is a double-edged sword. If the physical storage reaches 100% capacity, the VDO volume automatically switches to read-only mode to prevent corruption. Monitor usage regularly using
lvs -a -o +vdo_operating_mode,vdo_compression,vdo_deduplicationor set up Prometheus alerts when pool usage exceeds 85%. - Optimize RAM with Sparse Index: By default, the UDS index runs in dense mode (requiring ~1 GB of RAM per 1 TB of storage). For memory-constrained servers, pass the
--vdo-pool-args '--uds-memory-size=sparse'flag to reduce memory consumption by up to 80%, lowering the RAM footprint to around 250 MB. - Avoid Storing Pre-Compressed Files on VDO: Already-compressed formats like
.tar.gz,.zip, MP4 videos, or encrypted databases cannot be compressed or deduplicated further. Writing these files to VDO only wastes CPU cycles.

