Disable Zram Magisk [90% TRUSTED]

After boot:

su
cat /proc/swaps
# Should show no zram entries

free -h

Disabling ZRAM via Magisk is straightforward: create a module with a service.sh or post-fs-data.sh script that runs swapoff and resets the ZRAM device. While useful on high-end devices, it can degrade performance on older or low-RAM phones. Always verify after reboot and keep a recovery plan.

If you need a pre-made module zip for easy installation via Magisk Manager, you can create one using the steps above and compress the folder into a ZIP – Magisk recognizes the standard module structure.

Disabling zRAM using Magisk is a common optimization for power users who find that the default memory compression on Android causes micro-stutters or unnecessary CPU overhead, especially on devices with high physical RAM (8GB+). By removing this compressed swap space, you force the system to rely entirely on its faster physical RAM. 1. Identify Your Need

Before proceeding, confirm that your device has enough physical RAM to handle your typical workload without compression. zRAM works by compressing data in a specific segment of your RAM to "expand" the effective capacity. On devices with 12GB or 16GB of RAM, this compression often adds latency for no real benefit, while on 4GB devices, disabling it may lead to frequent app crashes. 2. Choose a Method

There are two primary ways to disable zRAM systemlessly using Magisk:

Pre-built Modules: Using a dedicated module like Swap-Disabler is the safest and easiest method. These modules are designed to run a script at boot that executes swapoff /dev/block/zram0.

Custom Boot Scripts: If you prefer a manual approach, you can create a simple shell script in /data/adb/service.d/. Magisk executes scripts in this directory during the boot process. 3. Manual Script Implementation

If you choose the manual route, create a file named disable_zram.sh with the following content:

#!/system/bin/sh # Wait for the system to fully boot sleep 30 # Disable the zram device swapoff /dev/block/zram0 # Reset the zram disksize to 0 to free up the allocated memory echo 1 > /sys/block/zram0/reset Use code with caution. Copied to clipboard

Place this file in /data/adb/service.d/ and set its permissions to 755 (executable) using a terminal or a root file explorer like MiXplorer. 4. Verify the Changes

After rebooting, you can verify if zRAM is truly disabled by using a terminal emulator (like Termux) and running: su free -m Use code with caution. Copied to clipboard

If the "Swap" row shows 0 for total, used, and free space, the operation was successful. 5. Potential Risks and Recovery

The primary risk is an Out of Memory (OOM) scenario. If your system runs out of physical RAM and has no swap space (zRAM) to fall back on, it will begin aggressively killing background processes or may even soft-reboot. If your device enters a bootloop or becomes unstable:

ADB Method: Connect to a PC and run adb shell magisk --remove-modules to strip all modules and reboot.

Safe Mode: Most Android devices will disable Magisk modules if you boot into Safe Mode (usually by holding Volume Down during the boot animation). How can I disable zram and enable and configure zswap - ARM

Ultimate Guide to Disabling zRAM via Magisk zRAM is a Linux kernel feature that creates a compressed block device in physical RAM. While it expands usable memory by compressing background processes, it introduces continuous CPU compression overhead. This can cause micro-stutters during heavy gaming and accelerates battery drain.

For high-end devices with 8GB, 12GB, or 16GB of RAM, zRAM is often unnecessary. Disabling it frees up CPU cycles and uses raw, uncompressed physical RAM for optimum performance.

Using Magisk is the safest and most efficient method to turn off zRAM. It modifies the system systemlessly without touching the /vendor or /system partitions directly. 🛠️ Methods to Disable zRAM via Magisk 1. Flash a Ready-Made Magisk Module

The simplest way to remove zRAM is by using dedicated systemless scripts. Modules such as Swap-Disabler on GitHub disable all active compressed swap spaces during early boot.

Step 1: Download the latest release .zip of a swap/zRAM disabler module from a trusted repository like Swap-Disabler GitHub. Step 2: Open the Magisk App on your rooted Android device. Step 3: Tap on the Modules tab at the bottom right corner.

Step 4: Select Install from storage and choose the downloaded .zip file. Step 5: Once flashed, tap Reboot to apply changes. 2. Create Your Own Custom Magisk Module

If a pre-compiled module does not disable zRAM on your device's specific kernel, you can build a light, custom boot script using Magisk's service.sh functionality. Step A: Structure Your Module Create a folder structure on your PC or device storage:

disable_zram/ ├── META-INF/ │ └── com/ │ └── google/ │ └── android/ │ ├── update-binary │ └── updater-script ├── module.prop └── service.sh Use code with caution. Step B: Create module.prop

Create a text file named module.prop and insert the following parameters: disable zram magisk

id=disable_zram name=Universal zRAM Disabler version=v1.0 versionCode=1 author=YourName description=Completely disables zRAM and clears swap allocations at boot. Use code with caution. Step C: Create service.sh

This script runs automatically during the late stages of device startup. Create a file named service.sh and insert the following code:

#!/system/bin/sh # Wait for the system boot to fully complete sleep 30 # Turn off the active zRAM swap device if [ -e /dev/block/zram0 ]; then swapoff /dev/block/zram0 # Reset disksize to release the memory allocated to zRAM echo 1 > /sys/block/zram0/reset fi # Apply to secondary zRAM partitions if present for i in 1 2 3; do if [ -e /dev/block/zram$i ]; then swapoff /dev/block/zram$i echo 1 > /sys/block/zram$i/reset fi done # Set swappiness to 0 to instruct the kernel not to swap echo 0 > /proc/sys/vm/swappiness Use code with caution. Step D: Zip and Flash

Compress the contents of the disable_zram directory into a .zip archive, transfer it to your phone, and flash it directly using the Magisk App. 🔍 How to Verify zRAM is Disabled

After flashing the module and rebooting your device, use a terminal emulator to confirm the changes are successful.

Download a terminal emulator from the Play Store (e.g., Termux) or use adb shell. Grant root access by typing: su Use code with caution. Run the following command to check active swap allocations: cat /proc/swaps Use code with caution.

Success Result: The terminal returns an empty output or shows no lines containing /dev/block/zram0.

Alternative Check: Type free -m or top to verify that both total and used swap memory are listed as 0 MB. ⚠️ Common Troubleshooting

Bootloops: If your device gets stuck on the boot logo, your specific kernel might crash when zRAM is turned off. Boot your phone into Safe Mode. This automatically disables all Magisk modules. Then, reboot normally, go into the Magisk App, and remove the custom module.

Apps Closing in Background: If you have 4GB or less of RAM, disabling zRAM leaves very little room for background processes. Without zRAM compression, the Android Low Memory Killer (LMKD) will aggressively terminate cached apps. If you experience this, uninstall the Magisk module to restore default multitasking.

Are you looking to optimize a device with high or low physical RAM? rompelhd/Swap-Disabler: A module designed to ... - GitHub

How to Disable zRAM on Android via Magisk On Android devices, zRAM creates a compressed block device in your RAM that acts as swap space. While it helps lower-end devices handle more background apps, it can cause CPU overhead or "stuttering" on high-end devices. Using Magisk allows you to disable this system-level feature persistently without needing to re-apply commands after every reboot. 1. Using a Magisk Module (Easiest Method)

The most reliable way to disable zRAM is by installing a dedicated Magisk module that runs a script at boot.

Find a Module: Search for "Disable zRAM" or "Swap Disabler" modules in community repositories like the Magisk-Modules-Alt-Repo. Installation: Download the .zip module file. Open the Magisk App and go to the Modules tab. Tap Install from storage and select the downloaded file. Wait for the process to finish and tap Reboot. 2. Manual Script Method (For Advanced Users)

If you prefer not to use a pre-made module, you can create a simple boot script. Magisk executes scripts placed in /data/adb/service.d/ during the boot process.

Create the script: Use a text editor (like MiXplorer) to create a file named disable_zram.sh. Add the command: Paste the following lines into the file:

#!/system/bin/sh # Disable zRAM swap swapoff /dev/block/zram0 # Reset zRAM to 0 to free up memory echo 1 > /sys/block/zram0/reset Use code with caution. Copied to clipboard

Set Permissions: Move the file to /data/adb/service.d/ and set its permissions to 755 (rwxr-xr-x) so it can execute.

Reboot: After restarting, the system will automatically turn off zRAM. 3. Check if it Worked

To verify that zRAM is disabled, you can use a terminal emulator (like Termux) or an ADB shell: Type free -m or cat /proc/swaps.

If the "Swap" or "zram0" line shows 0 or is missing, it is successfully disabled. Why Disable It?

Performance: Deactivating zRAM can provide a slight performance boost because the CPU no longer needs to compress and decompress data in the background.

Battery Life: It may slightly extend battery life by reducing CPU cycles used for compression.

Reduced Stuttering: Some users report fewer micro-stutters when the system relies entirely on physical RAM instead of a compressed swap.

Warning: If your device has low physical RAM (e.g., 4GB or less), disabling zRAM may cause background apps to close more frequently or lead to system instability. How to disable zram at boot · Issue #2 - GitHub After boot: su cat /proc/swaps # Should show

Activity * VR-25 commented. VR-25. on Mar 4, 2022. Owner. Sure. Add swap_off; exit to it. * xDoge26 commented. xDoge26. on Mar 17, Magisk-Modules-Alt-Repo/disable-low-ram - GitHub


Title: The Silence of the Swap

Kai stared at the terminal output, his thumb hovering over the Volume Down button. His aging Pixel 3a was gasping for air again. The launcher redrew. The keyboard lagged. Yet, the About Phone section cheerfully reported: 2.7 GB / 4 GB RAM used.

“Liar,” he whispered.

He knew the culprit. ZRAM. A compressed block device in RAM that acted as swap space. In theory, it was brilliant: squeeze stale data, fit more apps in memory. But on his worn-out eMMC and aging CPU, it was a death sentence. The kernel was spending more time compressing and decompressing memory pages than actually running his apps. The phone was drowning in its own cleverness.

He had root. He had Magisk. He had a plan.

He opened a root shell.

cat /proc/swaps

There it was. /dev/block/zram0. Type: partition. Size: 1.5GB. Used: 1.2GB. Priority: 100.

“Goodbye,” he muttered.

First, he turned it off:

swapoff /dev/block/zram0

The terminal hung for a second. Then, a cascade of log messages. The memory manager panicked briefly, redistributing the compressed data into real RAM. The phone stuttered for three seconds. Then, silence. The CPU temperature dropped by four degrees.

He checked: free -h. Total RAM: 3.7GB. Used: 2.9GB. No swap.

His heart raced. This is dangerous. Without swap, if memory filled, the Out-Of-Memory killer would start executing apps—not gracefully pausing them. But Kai didn't care. He wanted speed, not multitasking.

Now, to make it permanent.

Magisk was perfect for this. Not for hiding root, but for boot-time surgery. He created a custom module directory:

/data/adb/modules/disable_zram/

Inside, a simple post-fs-data.sh script:

#!/system/bin/sh
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
echo "ZRAM: Disabled and forgotten." > /dev/kmsg

He set permissions (0755) and added an empty module.prop:

id=disable_zram
name=Disable ZRAM
version=1.0
versionCode=1
author=Kai
description=Completely disables compressed swap at boot.

Then he rebooted.

The boot animation played—a little faster than usual, he thought. The home screen appeared. He opened Twitter, Spotify, and Chrome simultaneously.

No redraw. No stutter.

Keyboard: instant.

He opened a terminal again. cat /proc/swaps returned absolutely nothing. Title: The Silence of the Swap Kai stared

Kai leaned back, smiling. His phone wasn't a server. It didn't need sophisticated memory compression. It needed to respond.

He had freed it from the tyranny of ZRAM. And Magisk had made the silence permanent.


If you don’t want to fully disable ZRAM but reduce its impact:

# Set smaller ZRAM size (e.g., 512MB) in a boot script
echo 536870912 > /sys/block/zram0/disksize

Or change swappiness (lower = less swap usage):

echo 20 > /proc/sys/vm/swappiness

This method creates a service script that runs at boot, disabling ZRAM before Android uses it.

Why this works: Magisk executes all service.sh scripts in late_start service mode, after the kernel initializes ZRAM but before Android’s user space swaps to it.

Disabling ZRAM on a rooted Android device using Magisk is a powerful tweak for users who prioritize raw CPU performance over aggressive background app retention. The best method depends on your technical comfort level:

Before disabling ZRAM, evaluate your device’s RAM capacity. If you have 6 GB or less, think twice—ZRAM might be doing more good than harm. But on flagship devices with 8–12 GB of RAM, disabling ZRAM can reduce CPU overhead and deliver a snappier, more responsive experience.

Remember to verify the change after every reboot, and always keep a backup plan (Safe Mode or custom recovery) in case of instability.

Have you disabled ZRAM on your device? Share your experience and performance gains in the comments below!


Disclaimer: Modifying your device’s memory management carries inherent risk. The author is not responsible for data loss or hardware damage. Always perform a full backup before system-level changes.

(compressed RAM swap) on Android using is typically done to reduce CPU overhead and latency, especially on devices with high physical RAM (6GB+) Methods to Disable zRAM via Magisk Swap Torpedo (Recommended)

: This is a popular Magisk module specifically designed to "kill" zRAM at an early boot stage. It prevents the system from populating compressed swap, which can improve snappiness by avoiding CPU-intensive compression cycles. zRAM Swap Manager : A versatile tool from VR-25 on GitHub

that allows fine-tuning or complete deactivation. To disable zRAM using this module, add swap_off; exit to its configuration file located at /data/adb/vr25/zram-swap-manager-data/config.txt Manual Scripting : You can create a simple boot script in /data/adb/service.d/ to run the following command on every boot: #!/system/bin/sh swapoff /dev/block/zram0 Use code with caution. Copied to clipboard

Note: Disabling swap while the system is running may cause temporary unresponsiveness as data is moved back to physical RAM. Why Disable It? Performance

: Deactivating zRAM can provide a slight performance boost because the CPU no longer has to compress and decompress data in memory. Battery Life

: On high-RAM devices, disabling zRAM may extend battery life by reducing the background CPU cycles normally used for memory management.

: Some users report smoother gameplay (less stuttering) when zRAM is disabled, though running out of physical RAM will lead to app crashes. Why Keep It? Low RAM Devices

: If your device has 4GB of RAM or less, disabling zRAM will significantly reduce multitasking capabilities and likely lead to aggressive app killing by the system. Storage Protection

: zRAM does not write to internal storage (eMMC/UFS), so it does not wear out your hardware like traditional disk-based swap would. a Magisk boot script to disable zRAM?

Here’s a detailed technical write-up on disabling ZRAM using Magisk, covering what ZRAM is, why you might want to disable it, and step-by-step methods to do so safely.


You must set the permissions correctly for the script to execute:

Before proceeding, ensure your device meets the following:

Warning: Modifying kernel memory parameters can lead to boot loops if done incorrectly. Always have a backup of your boot image or a way to disable Magisk modules via Safe Mode.