Zram: Difference between revisions

From Alpine Linux
(Based on content creatied by Bignay2000 on 15 June 2024‎ in Talk:Tutorials_and_Howtos)
 
m (fixed typo)
 
Line 32: Line 32:
* vm.extfrag_threshold=0
* vm.extfrag_threshold=0
* vm.swappiness=100
* vm.swappiness=100
 
<!--
Remove the remarks once content is added
== Troubleshooting ==  
== Troubleshooting ==  
 
-->
== See Also ===
== See Also ==
* [https://wiki.archlinux.org/title/Zram Zram in Arch Wiki]
* [https://wiki.archlinux.org/title/Zram Zram in Arch Wiki]
* [https://en.wikipedia.org/wiki/zram Zram in Wikipedia]
* [https://en.wikipedia.org/wiki/zram Zram in Wikipedia]

Latest revision as of 17:13, 9 October 2024

This page documents how to set up ZRAM in Alpine.

Installation

Install the neccessary packages.

# apk add zram-init

Configuration

Make service start during next reboot.

# rc-update add zram-init

Configure ZRAM SWAP:

# vi /etc/conf.d/zram-init

For basic ZRAM swap:

  1. Update from num_devices=3 to num_devices=1
  2. Change the size0=512 to the desired megabytes (same as available RAM or 8GB, whichever is less)
  3. Change the default algorithm from zstd to lzo-rle
Warning: The default algorithm zstd does not work with Alpine Linux.10044


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:

  • vm.page-cluster=0
  • vm.extfrag_threshold=0
  • vm.swappiness=100

See Also