FurLC

ZRAM-Module

v1.3.0guide

A Magisk/KernelSU module that provides ZRAM compression algorithm support for Android devices

★74 stars
•Performance & Kernel•by FurLC•GPL-3.0•Updated May 31, 2025
Platforms:
✓ Magisk✓ KernelSU

Overview

ZRAM is an essential Linux kernel feature that creates a virtual compressed block device inside physical RAM. By compressing inactive memory pages rather than writing them to slow flash storage, ZRAM effectively expands usable RAM and keeps applications alive in the background.

However, stock Android kernels are typically locked to standard lz4 or lzo-rle compression algorithms, and fixed ZRAM sizes cannot easily be altered without recompiling the entire boot image. Furthermore, custom kernel developers who compile optimized out-of-tree compression drivers (such as lz4kd or zstdn) face challenges distributing these drivers cleanly.

Developed by FurLC, ZRAM-Module is a specialized performance utility for Magisk and KernelSU. It automates the loading of custom compression kernel modules (.ko) during early startup and configures custom ZRAM block sizes systemlessly.

Key Capabilities

  1. Automated .ko Driver Insertion: The module searches its internal directory during early boot and executes insmod / modprobe on bundled compression algorithm drivers (such as lz4kd.ko or zstdn.ko).
  2. Dynamic Algorithm Binding: Once the driver is registered in the kernel crypto API, the module binds it directly to /sys/block/zram0/comp_algorithm.
  3. Flexible Sizing: Allows users to specify an exact ZRAM block size (e.g., 4GB, 6GB, 8GB) before initializing swapon.
  4. Ideal for Custom Kernels: Perfect for users running custom kernels designed for performance and low-latency gaming.

Installation & Configuration

  1. Download the latest ZRAM-Module-v*.zip archive from GitHub releases.
  2. Install the package in Magisk or KernelSU.
  3. Reboot your device.
  4. Verify the active compression algorithm and ZRAM allocation in Termux:
    su -c cat /sys/block/zram0/comp_algorithm
    su -c free -m