How to Add zRAM on Ubuntu 26.10

zRAM is a compressed block device in RAM, used for swap or cache, which can improve performance on systems with limited RAM.

Enable zRAM on Ubuntu 26.10

Ubuntu supports zRAM through the systemd-zram-generator package.

Install the zram-generator package

apt update
apt install systemd-zram-generator -y

Output:

root@vps:~# apt update
Hit:1 http://archive.ubuntu.com/ubuntu stonking InRelease
...
All packages are up to date.

root@vps:~# apt install systemd-zram-generator -y
Installing:
  systemd-zram-generator

Create configuration file

Create a configuration file at /etc/systemd/zram-generator.conf:

nano /etc/systemd/zram-generator.conf

Add the following configuration:

[zram0]
zram-size = ram * 0.5
compression-algorithm = zstd

This sets zRAM to 50% of your total RAM.

You can also use:

compression-algorithm = lz4

for faster compression.

Save the file and exit.

Reload and start zRAM

Reload the systemd manager configuration:

systemctl daemon-reload

Start the zRAM setup service:

systemctl start [email protected]

Check if zRAM is active:

swapon --show

You should see /dev/zram0 as an active swap device.

Output:

root@vps:~# swapon --show
NAME       TYPE      SIZE USED PRIO
/dev/vda2  partition 512M   0B   -2
/dev/zram0 partition 1.7G   0B  100

That's it! You have successfully configured zRAM on Ubuntu 26.10.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS