OverlayFS Mount

On Android 10+, system partitions might no longer be able to remount as read-write. For devices use dynnamic partition, it is nearly impossible to modify system partiton as there is no space left. This module solves these problem by using OverlayFS. So what is OverlayFS? On Wikipedia:

OverlayFS is a union mount filesystem implementation for Linux. It combines multiple different underlying mount points into one, resulting in single directory structure that contains underlying files and sub-directories from all sources. Common applications overlay a read/write partition over a read-only partition, such as with LiveCDs and IoT devices with limited flash memory write cycles.

Benefits of using overlayfs for system partitions:

If you are interested in OverlayFS, you can read documentation at https://docs.kernel.org/filesystems/overlayfs.html

Build

There is two way:

GitHub Actions

Linux/WSL

  1. Clone this repo to your device
gitclonehttp://github.com/HuskyDG/Magisk_OverlayFS&&cdMagisk_OverlayFS
  1. Setup Android NDK in repository directory
wugneztiphtatnpdsr:i/dd-ln.dgko-org2l3eb.-cloimn/uaxn.dzriopid/repository/android-ndk-r23b-linux.zip
  1. Run bash build.sh

KernelSU problem

nsenter -t 1 -m sh
overlayfs_system --unmount-ksu

or set DO_UNMOUNT_KSU=true in /data/adb/modules(_update)/magisk_overlayfs/mode.sh

Change OverlayFS mode

Read-write mode of overlayfs will cause baseband on some devices stop working

###ex012po---rtrrreeeOaaaVdddE---RowoLnrnAlilYyty_eMblOudoDtecEfk=cae2audnlt(sctainlnlotrermeomuonutntasasreraeda-dw-rwirtiete)

Modify system files with OverlayFS

su -mm -c magic_remount_rw
su -mm -c magic_remount_ro

Overlayfs-based Magisk module

OVERLAY_IMAGE_EXTRA=0     # number of kb need to be added to overlay.img
OVERLAY_IMAGE_SHRINK=true # shrink overlay.img or not?
INCLUDE_MAGIC_MOUNT=false # enable legacy Magisk mount

# Only use OverlayFS if Magisk_OverlayFS is installed
if [ -f "/data/adb/modules/magisk_overlayfs/util_functions.sh" ] && \
    /data/adb/modules/magisk_overlayfs/overlayfs_system --test; then
  ui_print "- Add support for overlayfs"
  . /data/adb/modules/magisk_overlayfs/util_functions.sh
  support_overlayfs && rm -rf "$MODPATH"/system
fi

Bugreport

Reset overlayfs

Without Magisk

# - Create a writeable directory in ext4 (f2fs) /data
# which will be used for upperdir
# - On some Kernel, f2fs is not supported by OverlayFS
# and cannot be used directly
WRITEABLE=/data/overlayfs

mkdir -p "$WRITEABLE"

# - Export list of modules if you want to load mounts by overlayfs
# - If you have /vendor /product /system_ext as seperate partitons
# - Please move it out of "system" folder, overwise **BOOM**
export OVERLAYLIST=/data/adb/modules/module_a:/data/adb/modules/module_b

# - If there is Magisk, export this in post-fs-data.sh (before magic mount):
export MAGISKTMP="$(magisk --path)"

# - Load overlayfs
./overlayfs_system "$WRITEABLE"

Source code

By Zenlua

Takeda-senpai

Module Info

Module By : Takeda-senpai
Magisk : ✅ Supported
KernelSu : ✅ Supported
KernelSuNext : ✅ Supported
APATCH : ✅ Supported
Date Release :
If the link is broken or there is something that needs to be updated in the post contact us.

© 2025 Magisk Community