This tutorial aims to provide steps to enable and configure ZRAM on Linux Mint.
The tutorial has been tested on Linux Mint 21.3 and 22.1 CE - but should equally work on Ubuntu, Debian, LM Debian Edition and similar.
1. What is ZRAM? Is it any good?
Wikipedia provides a summary description about ZRAM: https://en.wikipedia.org/wiki/Zram
In short: When used for swap, ZRAM allows Linux to make more efficient use of RAM. This is particularly nice on machines that do not have much RAM - or for running applications that require a huge amount of RAM (like certain demanding games).
ZRAM is part of the Linux kernel. It is enabled by default on Android/ Chromebooks/ PopOS / Fedora.
2. Enable ZRAM
a) Install zram-tools:
zram-tools provides tools and scripts to enable and configure zram.b) Adapt the config file:Uncomment the following lines and save the document:c) Optimize options for the use of swap on ZRAM:
Since ZRAM behaves differently than ordinary disk swap, we have to configure the system's swap to take full advantage of ZRAM:
At the end of the file, add the following line for better performance and save the file.
Page-cluster = 3 is the default, when using swap on an HDD or SDD drive.
Page-cluster = 0 should be set when ZRAM is enabled - this is also the default on Android/ Chromebooks/ PopOS.
Save this file.
3. Reboot your system
4. Check if everything works as expected:
The following commands might be helpful:
Check the status of zramswap:Provide information on zram:Show information on swaps (including zram):Check options:5. Have fun!
6. If you want to disable ZRAM:
In order to disable, just
1. Uninstall zram-tools:
2. Open the file /etc/systctl.conf:- In this file, delete (or comment) the line that starts with vm.page-cluster
- Save this file
3. Reboot.
1. What is ZRAM? Is it any good?
Wikipedia provides a summary description about ZRAM: https://en.wikipedia.org/wiki/Zram
In short: When used for swap, ZRAM allows Linux to make more efficient use of RAM. This is particularly nice on machines that do not have much RAM - or for running applications that require a huge amount of RAM (like certain demanding games).
ZRAM is part of the Linux kernel. It is enabled by default on Android/ Chromebooks/ PopOS / Fedora.
2. Enable ZRAM
a) Install zram-tools:
zram-tools provides tools and scripts to enable and configure zram.
Code: Select all
sudo apt-get install zram-tools
Code: Select all
sudo nano /etc/default/zramswap
Code: Select all
ALGO=lz4 #use ALGO=zstd on systems with less than 4 GB of RAM
PERCENT=50
Since ZRAM behaves differently than ordinary disk swap, we have to configure the system's swap to take full advantage of ZRAM:
Code: Select all
sudo nano /etc/sysctl.conf
Page-cluster = 3 is the default, when using swap on an HDD or SDD drive.
Page-cluster = 0 should be set when ZRAM is enabled - this is also the default on Android/ Chromebooks/ PopOS.
Code: Select all
vm.page-cluster = 0
3. Reboot your system
4. Check if everything works as expected:
The following commands might be helpful:
Check the status of zramswap:
Code: Select all
sudo systemctl status zramswap.service
Code: Select all
zramctl
Code: Select all
swapon
Code: Select all
cat /proc/sys/vm/page-cluster #should be 0
cat /sys/block/zram0/comp_algorithm #should be the same as configured by ALGO= in /etc/default/zramswap
6. If you want to disable ZRAM:
In order to disable, just
1. Uninstall zram-tools:
Code: Select all
sudo apt remove zram-tools
2. Open the file /etc/systctl.conf:
Code: Select all
sudo nano /etc/sysctl.conf
- Save this file
3. Reboot.
Last edited by goebbe on Mon Jul 14, 2025 10:50 am, edited 1 time in total.
Source: https://forums.linuxmint.com/viewtopic.php?t=427964
Source: https://forums.linuxmint.com/viewtopic.php?t=427964