Script to dynamically enable ZRAM on a Raspberry Pi or other Linux system.
Automatically detects the number of CPU cores to allocate to ZRAM computation, disables existing swap and enables ZRAM swap.
Download the script and copy to /usr/local/bin/ folder
sudo wget -O /usr/local/bin/zram.sh https://raw.githubusercontent.com/abarrile/rpi_zram/master/zram.sh
make file executable
sudo chmod +x /usr/local/bin/zram.sh
edit /etc/rc.local file to run script on boot
sudo nano /etc/rc.local
add line before exit 0
/usr/bin/local/zram.sh &