Skip to content

Instantly share code, notes, and snippets.

@timothyklim
Forked from sultanqasim/zram.sh
Created January 27, 2018 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothyklim/3aeb4a53c6b9d0f483026a2aa4890f2a to your computer and use it in GitHub Desktop.
Save timothyklim/3aeb4a53c6b9d0f483026a2aa4890f2a to your computer and use it in GitHub Desktop.
ZRAM config for Raspberry Pi 3
#!/bin/bash
# Raspberry Pi ZRAM script
# Tuned for quad core, 1 GB RAM models
# put me in /etc/init.d/zram.sh and make me executable
# then run "sudo update-rc.d zram.sh defaults"
modprobe zram
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm
echo 268435456 >/sys/devices/virtual/block/zram0/mem_limit
echo 536870912 >/sys/devices/virtual/block/zram0/disksize
mkswap /dev/zram0
swapon -p 0 /dev/zram0
sysctl vm.swappiness=70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment