zram swap - wiedehopf/adsb-wiki GitHub Wiki
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
On Ubuntu it seems you need to install an extra package:
apt install linux-image-extra-virtual