Zram and Swap Space on Linux Mint
Updated 20 December 2025
Zram can be used for more than swap space, but that's all I'm using it for. Installing zram creates a swap partition using compressed RAM. Physical swap space on Linux Mint is a swap file, created during installation of the operating system. I always increase the size the swap file when I install Linux Mint:
sudo swapoff /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=8192
sudo chown root:root /swapfile
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfileThe above is for 8 gigabytes of RAM. Simply multiply 1024 times the number of gigabytes installed.
Note, 16 December 2025: I'm no longer doing this, but I'm not bothering to delete the swap file.
Install zram
There are other ways to do it, but I find this the easiest. At the terminal:
git clone https://github.com/foundObjects/zram-swap.git
cd zram-swap && sudo ./install.sh
You can change the percentage in: /etc/default/zram-swap
I found another way of doing this on Arch-based distributions (and I'm only mentioning this for future reference since the above method works as well): https://forum.manjaro.org/t/howto-install-and-configure-zram-using-zram-generator/168610
The author of the Easy Linux Tips Project is wrong when he says zswap is better than zram. For people like me, who are not gamers or developers, zram is better than zswap. I haven't seen my swap file used since I installed zram on my computer. Not even once. I keep an applet on my panel that shows me swap usage, and I've never come close to reaching the zram partition size.
Note, 18 December 2025: When I found out CachyOS uses zram only for swap space, I changed my current distribution to use zram only. I want to see how long it can last without physical swap space. I'll mention it if I experience any issues.