How to Enable zram Swap on Android - Licosha

How to Enable zram Swap on Android

How to Enable zram Swap on Android

Licosha — zram is a Linux kernel module for creating a compressed block device in RAM. In short, zram is useful to make use of device RAM for better use and make it more efficient for the device performance especially in devices with low RAM but need extensive multitasking, in this case the Android devices. For more about zram, you can check the Wikipedia about zram.

Usually, we do not need to care whether our Android device are to zram or not to zram, because it is already handled by the settings from the Android device manufacturer that installed the ROM to our device.

But when it comes to custom ROMor Android GSI, zram is one of the extra thing we must take care manually so we can get better performance on our Android device.

Illustration image, by ColiN00B @Pixabay

We can understand why zram is not enabled by default after installing Android GSI to our device because of how and what for Android GSI is built. But even on custom ROMs I installed on my ASUS Zenfone Live L2 Android phone, I found that zram is not enabled by default.

Without zram being enabled, I can feel reasonable differences on my ASUS Zenfone Live L2 Android phone peformance especially when switching apps where the apps are more often reloaded thus we are spending more time on multitasking.

How to check if our Android device has zram enabled

To check whether our Android device has zram enabled or not, there are lots of apps that can do that actually.

On Play Store, we can use keyword like disk info to search apps that has capability to show our Android device hardware storages, including zram.

Usually in those apps, zram can be notices as swap, SwapTotal, or simply zram. If none of those exists or it is exists but the sum is zero, then zram is not enabled.

SWAP Memory showed up on SmartPack-Kernel Manager app

For example I am using SmartPack-Kernel Manager. On the app’s homepage, I can know whether zram is enabled or not by checking whether the Swap is exist under the Memorysection.

How to enable zram on Android device

There are several ways we can enable zram on our Android device:

  1. Enabling zram on the build.prop.
  2. Setting zram manually using system tweaker app like SmartPack-Kernel Manager.

The first way by editing the build.prop is easier, I mostly do it when using a GSIon my ASUS Zenfone Live L2 Android phone.

However it’s different story on custom ROM. I have installed two custom ROM on my ASUS Zenfone Live L2 Android phone and editing build.prop can’t make the system to enable zram.

So for custom ROM, I always using SmartPack-Kernel Manager app to enable zram on the device.

1. Enable zram on Android by editing build.prop

The first way to enable zram on our Android device if it is not enabled by default is by editing the build.prop reside in our Android device system directory. How it works?

As we know, the build.prop is a special text file in Android device that holds various system related default settings that is usually located on /system/build.prop or /system/system/build.prop.

Edit our Android build.prop and add the following lines to the end of the texts:

# ZRAMro.vendor.qti.config.swap=truero.vendor.qti.config.zram=true
zram properties added on build.prop

Don’t forget to add an empty line at the end of the build.prop.

2. Enable zram on Android using system tweaker app like SmartPack-Kernel Manager

There are lots of apps that provide capability to tweak our Android device system performance, including zram. You can find those kind of apps on Play Store usually under keyword like Kernel manager.

The app that I mainly use on my ASUS Zenfone Live L2 Android phone to enable zram if the build.prop method is not working is SmartPack Kernel Manager.

Requirements:

  • Android device is rooted.
  • SmartPack-Kernel Manager app, download the latest version on its GitHub page.

Read also: How to install Android app/game from apk, apks or xapk to our device

Steps to enable zram using SmartPack-Kernel Manager

  1. On the main menu of SmartPack-Kernel Manager, open the sidebar by tapping the hamburger icon on the top left.
  2. Then on the sidebar menu, scroll down and find Virtual Memory.
  3. Now we are in the Virtual Memory setting menu of SmartPack-Kernel Manager, scroll down and find the Z-RAMsection.
  4. First on the bottom, choose the “Z-RAM Algorithm” first. It is usually “lzo” or “lz4” depend on our Android device kernel.
  5. Next, on the Disksize slide under the Z-RAMsection, adjust it to how much we want our zram size is. Usually the zram size is between 25% to 50% of RAM size. For example if our Android device RAM is 2 GB, then we can set the zram size around 512 MB or 1 GB (1024 MB) (no need to be exact).

    Set zram size on SmartPack-Kernel Manager

  6. After we set the zram size to our liking, turn on the Apply on boot and Virtual memory tunable'sswitch. Next reboot our Android device.

    Set switches on zram setting SmartPack-Kernel Manager

  7. After the Android device is rebooted, check whether the zram or swap size is present to make sure the zram is enabled.


Emoticon Emoticon

Formulir Kontak