- Ubuntu 25.04 because LVM VDO (compression) not supported on early versions (I tried 24.04)
- Installed kernel 6.14
apt install lvm2- create partition ${your partition number} for swap
sudo pvcreate /dev/nvme0n1${your partition}sudo vgcreate vg /dev/nvme0n1${your partition}sudo lvcreate --type vdo -L ${your size}G -V ${your size}G --compression y --deduplication n vg/lv_swapsudo vgchange -ay# activation all created VDO for tests before rebootsudo blkid /dev/vg/lvol0# remember UUID ${your uuid}sudo nano /etc/fstab# appendUUID=${your uuid} none swap sw 0 0to itsudo systemctl edit --force --full dev-vg-lvol0-swap.service# unit for activation VDO before fstab mounting with content:
### /etc/systemd/system/dev-vg-lvol0-swap.service
[Unit]
Description=Activate LVM volumes before mounting filesystems
DefaultDependencies=no
Before=local-fs-pre.target
After=systemd-udev-settle.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/vgchange -ay
[Install]
WantedBy=local-fs-pre.target
sudo systemctl enable dev-vg-lvol0-swap.servicesudo reboot, if you have some problems, just wait timout, it will boot again :)swapon --show# used swapssudo vdostats --human-readable# compression statistics
Pros: speed up access to data in swap (less data must be loaded from disk) Cons: memory to work VDO and CPU for compression
You can try to use deduplication too...