Post #3306671
2026-06-13 06:37 UTC
Use systemd-zram-generator. The process is explain in the DebianWiki and the ArchWiki and this random blog, but it boils down to just a few commands you need to run:
$ apt install systemd-zram-generator
$ sudoedit /etc/systemd/zram-generator.conf
[zram0]
zram-size = min(ram, 8192)
compression-algorithm = zstd
$ sudo systemctl daemon-reload && sudo systemctl start systemd-zram-setup@zram0.service
You can tweak the settings above. Fedora recommends using zram-size = min(ram, 8192), which would correspond to 8GB ZRAM in your case. CachyOS uses a less conservative config with zram-size = ram.
To confirm that zram is working, run zramctl. It should print something like
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 8G 430.8M 137.6M 142.9M [SWAP]
See also Improving system responsiveness under low-memory conditions.
Replies (1)
-
@MonkderVierte@lemmy.zip 2026-06-13 09:15
Systemd absorbed zram now. And no, you don’t need a background service for this. # modprobe zram # zramctl /dev/zram0 --algorithm zstd --size "$(($(grep -Po 'MemTotal:\s*\K\d+' /proc/meminfo)/2))KiB" # mkswap -U clear /dev/zram0 # swapon --discard --priority 100 /dev/zram0