June 2017
Intermediate to advanced
478 pages
13h 14m
English
The zram driver creates RAM-based block devices named /dev/zram0, /dev/zram1, and so on. Pages written to these devices are compressed before being stored. With compression ratios in the range of 30% to 50%, you can expect an overall increase in free memory of about 10% at the expense of more processing and a corresponding increase in power usage.
To enable zram, configure the kernel with these options:
CONFIG_SWAP CONFIG_CGROUP_MEM_RES_CTLR CONFIG_CGROUP_MEM_RES_CTLR_SWAP CONFIG_ZRAM
Then, mount zram at boot time by adding this to /etc/fstab:
/dev/zram0 none swap defaults zramsize=<size in bytes>,swapprio=<swap partition priority>
You can turn swap on and off using these commands:
# swapon /dev/zram0 ...
Read now
Unlock full access