Modules / hybrid_mount

Hybrid Mount

META

Next Generation Mounting Metamodule with OverlayFS and Magic Mount.

README

Hybrid Mount

Language Platform License

Hybrid Mount is a mount orchestration metamodule for KernelSU and APatch.
It merges module files into Android partitions with a hybrid strategy:

  • OverlayFS when kernel/filesystem support is stable.
  • Magic Mount (bind mount) as fallback or per-path override.

The runtime is designed for predictable boot behavior, conflict visibility, and policy-level control.

πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£


Table of Contents


Design Goals

  1. Compatibility-first mounting across diverse Android kernels.
  2. Deterministic behavior through explicit planning and conflict analysis.
  3. Operational safety with recovery-friendly defaults.
  4. Automation-friendly CLI for WebUI or external controllers.

Architecture

At startup, hybrid-mount follows this pipeline:

  1. Load config (file + CLI override).
  2. Scan module tree and inventory mountable entries.
  3. Generate an execution plan (overlay/magic/ignore).
  4. Apply mounts and persist runtime state.
  5. Emit diagnostics/conflict reports when requested.

Key implementation modules:

  • src/conf: config schema, loader, CLI handlers.
  • src/core/inventory: module scanning and inventory modeling.
  • src/core/ops: planning, execution, synchronization.
  • src/mount: overlayfs + magic-mount backends.
  • src/sys: filesystem/mount helpers and low-level integration.

Repository Layout

.
β”œβ”€ src/                 # daemon/runtime implementation
β”œβ”€ module/              # module scripts and packaging assets
β”œβ”€ xtask/               # build/release automation commands
β”œβ”€ tools/notify/        # optional helper binary
β”œβ”€ Cargo.toml           # workspace + runtime crate settings
└─ README*.md           # user and developer docs

Configuration

Default path: /data/adb/hybrid-mount/config.toml.

Top-level fields

Key Type Default Description
moduledir string /data/adb/modules Module source directory.
mountsource string auto-detect Runtime source tag (e.g. KSU, APatch).
partitions list|csv string [] Extra managed partitions.
overlay_mode ext4 | tmpfs ext4 Overlay upper/work backing mode.
disable_umount bool false Skip unmount operations (debug-only).
allow_umount_coexistence bool false Allow coexistence with existing umount behavior.
default_mode overlay | magic overlay Default policy for module paths.
rules map {} Per-module path-level mount policy.

Example

moduledir = "/data/adb/modules"
mountsource = "KSU"
partitions = ["system", "vendor"]
overlay_mode = "ext4"
disable_umount = false
allow_umount_coexistence = false
default_mode = "overlay"

[rules.my_module]
default_mode = "magic"

[rules.my_module.paths]
"system/bin/tool" = "overlay"
"vendor/lib64/libfoo.so" = "ignore"

CLI

hybrid-mount [OPTIONS] [COMMAND]

Global options:

  • -c, --config <PATH> custom config path
  • -m, --moduledir <PATH> override module directory
  • -s, --mountsource <SOURCE> override source tag
  • -p, --partitions <CSV> override partition list

Subcommands:

  • gen-config generate config file
  • show-config print effective config JSON
  • save-config --payload <HEX_JSON> save config from WebUI payload
  • save-module-rules --module <ID> --payload <HEX_JSON> update one module rule set
  • modules list detected modules

Build

Prerequisites:

  • Rust toolchain from rust-toolchain.toml
  • Android NDK (recommended r27+)
  • Node.js 20+ (only when building WebUI assets)

Build commands:

# full package
cargo run -p xtask -- build --release

# runtime only (skip web assets)
cargo run -p xtask -- build --release --skip-webui

Artifacts are produced under output/.

Operational Notes

  • If a bad config causes boot issues, regenerate a minimal config with gen-config and reapply module rules incrementally.
  • For binary size optimization, prefer dependency feature trimming and release profile tuning before invasive refactors.

License

Licensed under GPL-3.0.

Release History

v3.4.6

Published on April 9, 2026
Download

v3.4.6

Features

  • xtask Call notify crate directly

Maintenance

  • Split notify into separate repository

v3.4.5

Published on April 6, 2026
Download

v3.4.5

Features

  • Add ext4 probe and post-check for APatch nuke flow

  • Finalize APatch nuke KPM support

  • Enhance ext4 sysfs handling by using function pointers for dynamic symbol resolution

Fixes

  • Fix late mode check Signed-off-by: Tools-app localhost.hutao@gmail.com

  • Fix panic

  • Make kpm module compile in CI toolchain headers

  • Collapse nested if to satisfy clippy

  • Use APatch kptools for kpm nuke calls

  • Only extract kpm assets on APatch

Performance

  • sync Reduce repeated module tree traversal

Maintenance

  • Remove extra kpm README and related doc entries

v3.4.2

Published on April 3, 2026
Download

v3.4.2

Other

  • Fix installer notice confirmation blocking

  • Improve mount planning diagnostics

  • Refactor magic mount stats into context

  • Make node traversal deterministic

  • Polish executor naming and diagnostics text

  • Unify logging format across runtime

v3.4.1

Published on April 2, 2026
Download

v3.4.1

Fixes

  • core Resolve naming refactor build errors

  • recovery Avoid state borrow conflict

  • planner Split configured extra partitions

  • planner Preserve real partition names for symlink targets

  • umount Restore queued try-umount commit

Refactors

  • core Split boot and command entrypoints

  • executor Split overlay and magic handlers

  • storage Split backends and ext4 setup

  • recovery Split retry state and markers

  • core Extract finalization workflow

  • core Separate module description updates

  • inventory Separate module presentation

  • core Clarify controller and runtime names

  • startup Rename boot recovery modules

  • naming Rename entry, inventory, and fallback modules

  • naming Rename status and finalization modules

  • umount Drop extra /mnt cleanup and unify wording

Tests

  • planner Add mount plan scenarios

CI / Tooling

  • submodule Track webui on configured branch

  • release Generate changelog with git-cliff

Other

  • .github/workflows/update_webui_submodule.yml

v3.3.1

Published on March 29, 2026
Download

v3.3.1

Changes since v3.3.0:

  • ci(release): install armv7 android rust target

v3.2.2

Published on March 24, 2026
Download

v3.2.2

Changes since v3.2.1:

  • build: pin nightly toolchain for rustfmt consistency
  • chore(submodule): update webui [skip ci]
  • ci: restrict webui updater workflow to dev branch
  • fix: make cargo clippy happy
  • metainstall: add support for hot install
  • feat(core): auto detect manual mount scripts to prevent conflicts
  • chore: update license headers [skip ci]
  • chore(release): sync version v3.2.1 [skip ci]

v3.2.1

Published on March 22, 2026
Download

v3.2.1

Changes since v3.2.0:

  • chore: remove unused update_desc
  • Revert "ci: promote only latest prereleases"
  • Revert "ci(workflow): fix unrecognized 'secrets' context in if conditions"
  • sync: sync magic mount updates from upstream
  • adj: removed normalize_module_layout
  • chore(deps): bump the crates group with 2 updates
  • chore(tools): update notify binary [skip ci]
  • chore(deps): bump rustls-webpki
  • chore: bump webui submodule
  • Update dependabot.yml
  • Remove leftover EROFS module tool
  • refactor: Fixed the issue with the size of the statistics
  • BREAKING CHANGE: feat: The erofs is marked as deprecated
  • ci: add caches to compilation workflows
  • xtask: adj: adj target platform(Tools-cx-app/meta-magic_mount-rs#31)
  • Fix EROFS magic fallback and logging
  • Fix EROFS empty remount handling
  • ci(workflow): fix unrecognized 'secrets' context in if conditions

v3.1.6

Published on March 15, 2026
Download

v3.1.6

Changes since v3.1.5:

  • chore: fmt
  • adj: Adjusting loop logic
  • chore: make cargo clippy
  • fix: Fixing layout errors
  • chore: fmt
  • feat: removed trait MountDriver in backend
  • fix: fix glob rules again
  • fix: make clippy happy
  • fix: restore missing utils module and logging statements
  • perf: eliminate O(N^2) tree cloning in magic mount and fix I/O safety
  • fix: resolve critical mount bugs, ext4 inode exhaustion, and strict sync limits
  • fix: fix error glob rules
  • improve: Delete all imgs before mounting img.
  • chore(deps): bump quinn-proto from 0.11.13 to 0.11.14 in /tools/notify in the cargo group across 1 directory (#249)
  • feat(issue): add kernel version & hook type fields with auto-labeling
  • chore: update license headers [skip ci]
  • ci: delete unused workflow i18n
  • ci: fix webui submodule path
  • chore: add hybrid-mount-webui-md3 as webui submodule
  • chore: remove webui folder for submodule migration
  • chore(tools): update notify binary [skip ci]
  • chore(deps): update dependencies in Cargo.lock
  • chore(deps-dev): bump eslint in /webui in the crates group
  • chore(deps): bump the crates group with 2 updates
  • fix: make clippy happy
  • refactor: remove random kworker camouflage feature
  • feat: refactor logger system
  • feat: add const_format dependency and refactor path constants
  • feat: normalize module directory layout during sync
  • chore(logging):logger tag to "Hybrid_Logger"
  • ci: Simplify commit and push steps in workflow (#242)
  • chore(tools): update notify binary [skip ci]
  • chore(deps): bump aws-lc-sys
  • chore(tools): update notify binary [skip ci]
  • chore(deps): bump the crates group in /tools/notify with 2 updates
  • chore(deps): bump zip from 8.1.0 to 8.2.0 in the crates group
  • chore(release): sync version v3.1.5 [skip ci]

v3.1.5

Published on March 1, 2026
Download

v3.1.5

Changes since v3.1.4:

  • fix(core): expose full anyhow error chain and sanitize newlines for module.prop
  • feat(core): catch daemon startup errors and display crash reason in module description
  • feat(i18n): add step to delete old translation branch in workflow
  • chore(deps-dev): bump globals from 17.3.0 to 17.4.0 in /webui in the crates group (#234)
  • [skip ci]fix: update image source and correct binary name in README files
  • chore(deps): bump actions/upload-artifact in the crates group
  • New Crowdin translations by GitHub Action
  • refactor: remove unused import of Show from ConfigTab component
  • refactor: remove umount coexistence option and optimize ModulesTab performance
  • Refactor store usage to uiStore and moduleStore across components
  • feat: refactor application structure and implement new store management for configuration, modules, and system state
  • fix(webui): resolve swipe stuck issue caused by requestAnimationFrame race condition
  • feat: add Vietnamese translation for Hybrid Mount (#229)
  • fix: fix error handling when scan modules (#228)
  • feat(perf): implement UI performance optimizations
  • chore(release): sync version v3.1.4 [skip ci]

v3.1.4

Published on February 27, 2026
Download

v3.1.4

Changes since v3.1.3:

  • fix(planner): correct module partition directory detection logic
  • chore(deps): bump rollup

v3.1.2

Published on February 23, 2026
Download

v3.1.2

Changes since v3.1.1:

  • feat: add remote release step for KernelSU-Repo in workflow
  • fix: correct typo in module summary
  • chore(release): sync version v3.1.1 [skip ci]

Module Details

Module ID
hybrid_mount
911
Stars
11
Releases

Latest Version

v3.4.6
Released 4/9/2026
Download Now