Zram
This page documents how to set up ZRAM in Alpine Linux. Zram can be used as an alternative to Swap partition.
Installation
Install the neccessary packages:
# apk add zram-init
Configuration
For a basic ZRAM swap, configure ZRAM by editing the file /etc/conf.d/zram-init as follows:
Contents of /etc/conf.d/zram-init
num_devices=1
size0=8000
Start services:
# rc-service zram-init start
View the ZRAM drive:
# cat /proc/swaps
Check Algorithms:
# cat /sys/block/zram0/comp_algorithm
Advanced setups may also add these parameters to /etc/sysctl.conf as follows:
Contents of /etc/sysctl.conf
vm.page-cluster=0
vm.extfrag_threshold=0
vm.swappiness=100
To ensure that service starts during next reboot:
# rc-update add zram-init