Outcome: You’ll enable compressed RAM swap (zram) so your Linux system stays responsive under memory pressure.
Who this is for: Ubuntu/Debian users on low-RAM laptops, mini PCs, or VMs (especially 4–8GB RAM).
Time required: About 5–10 minutes.
Quick Answer
Install zram-tools (or zram-config), restart the zram service or reboot, then verify with zramctl and swapon --show. If zram is active, your system can compress swap pages in RAM and reduce disk thrashing.
If your Linux machine slows to a crawl with multiple tabs or apps open, zram is one of the highest-impact fixes you can turn on quickly.
Prerequisites
- Ubuntu or Debian-based Linux system
- Sudo access
- Kernel with zram support (common on modern Ubuntu/Debian installs)
The Single Trick: Turn On Zram Swap
- Update package lists.
Run:sudo apt update - Install the zram package.
On most Ubuntu/Debian systems:sudo apt install -y zram-tools
On some systems with older packaging:sudo apt install -y zram-config - Apply the service.
Run:sudo systemctl restart zramswap.service
If that service name isn’t available, just reboot once:sudo reboot - Verify zram is active.
Run:zramctl
Expected: a device like/dev/zram0with a compression algorithm such aszstd. - Verify swap is using zram.
Run:swapon --showandfree -h
Expected:/dev/zram0appears as swap and multitasking feels smoother.
Expected Result Checks
zramctlshows an active zram block device.swapon --showlists zram swap.- Fewer freezes/stutters when opening many tabs/apps.
- Less disk-swap churn during heavy memory use.
Common Mistakes
- Installing but never rebooting/restarting: the change won’t apply immediately without that step.
- Using the wrong package name: try
zram-toolsfirst, thenzram-config. - Skipping verification commands: always check
zramctlandswapon --show. - Expecting miracles on very old CPUs: compression helps memory pressure, but CPU limits still exist.
Troubleshooting
zramctl: command not found: install or reinstallutil-linuxand retry.- No zram device listed: run
sudo systemctl status zramswap.serviceand reboot. - Only disk swap appears: confirm zram service is active, then re-run
swapon --show. - Still feels slow: close startup-heavy apps and test again under the same workload.
Reference Links
- Linux kernel zram documentation: https://docs.kernel.org/admin-guide/blockdev/zram.html
- ArchWiki zram guide: https://wiki.archlinux.org/title/Zram
- Ubuntu community zram notes: https://wiki.ubuntu.com/ZRam
systemctldocumentation: https://www.freedesktop.org/software/systemd/man/systemctl.htmlswaponmanual: https://man7.org/linux/man-pages/man8/swapon.8.htmlfreecommand manual: https://man7.org/linux/man-pages/man1/free.1.html
Related Tech Tricks
- Workflow Trick: Increase Linux Inotify Watches for VSCode Large Project File Monitoring
- 5-Minute Fix: Flush DNS Cache on Windows to Restore Website Loading
- Hidden Feature: Unlock God Mode on Windows 11 for 200+ Settings in One Folder
Next Step
Keep zram enabled for a day, run your normal browser + app workload, and compare responsiveness. If performance improves, pair this with startup-app cleanup for an even bigger win.