Skip to content

zram swap

wiedehopf edited this page Oct 31, 2024 · 5 revisions

Simple script which runs on boot and puts swap on zram

  • prevents swap from wearing out the sd-card
  • is faster than disk backed swap

How?

Instead of writing unused data in memory to disk like normal swap, that data is compressed and written to memory. This works surprisingly well as typically a lot of memory to be swapped out is compressable.

Install

sudo bash -c "$(wget -O - https://github.com/wiedehopf/adsb-scripts/raw/master/zram-swap-install.sh)"

Recommended, disable dphys-swapfile service on raspbian:

sudo systemctl disable dphys-swapfile.service

Uninstall

sudo systemctl disable --now zram-swap
sudo reboot

Check usage:

zramctl
Clone this wiki locally