Zram

From Alpine Linux
Revision as of 17:11, 9 October 2024 by Prabuanand (talk | contribs) (Based on content creatied by Bignay2000 on 15 June 2024‎ in Talk:Tutorials_and_Howtos)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Troubleshooting

See Also =