Introduction to Dynamic Partitions and the `super` Image
Modern Android devices leverage a powerful partitioning scheme known as Dynamic Partitions, introduced with Android 10. This system replaces the static, fixed-size partitions (like system, vendor, product) with a flexible, logical volume management layer residing within a single physical partition called super. This architecture allows OEMs to push OTA updates that dynamically resize partitions, offering greater flexibility and reducing device fragmentation.
For advanced users, custom ROM developers, or those seeking to optimize their device’s storage layout, understanding and manipulating the super image is a crucial skill. This guide provides a practical, expert-level lab to deconstruct, redesign, and flash a custom super image, enabling tailored partition layouts beyond stock configurations.
Prerequisites and Tools
Before diving in, ensure you have the following:
- A Linux environment (Ubuntu/Debian recommended) or Windows Subsystem for Linux (WSL).
- ADB and Fastboot tools installed and configured.
- A target Android device with an unlocked bootloader.
- Familiarity with command-line operations.
- Necessary tools for dynamic partition manipulation:
lpunpack,lpadd,lpmake,img2simg(from AOSP source or pre-built binaries). - A stock
super.imgfrom your device’s firmware, or access to a full factory image.
Understanding the `super` Partition Structure
The super partition isn’t a traditional filesystem; rather, it’s a container for Logical Partition Manager (LPM) metadata and a collection of underlying sparse images for partitions like system, vendor, product, odm, etc. The metadata defines the layout: which logical partitions belong to which update groups (e.g., q_dynamic_partitions_a, q_dynamic_partitions_b for A/B slots), their sizes, and their properties.
Key Components:
- Metadata: Describes the logical partitions, their names, sizes, and membership in update groups.
- Groups: Collections of logical partitions. Devices supporting A/B updates typically have two groups (e.g., `q_dynamic_partitions_a` and `q_dynamic_partitions_b`), allowing seamless updates.
- Partitions: The actual logical partitions like `system`, `vendor`, `product`, `odm`, etc., which reside within the `super` block device.
Lab Setup: Extracting Your Stock `super` Image
First, we need to obtain and deconstruct your device’s existing super.img.
-
Extract `super.img` from Device (if not available in factory image)
Boot your device into fastboot mode. If your device supports
fastbootd(Android 11+), you might be able to directly dump thesuperpartition.adb reboot fastbootfastboot --set-active=a # Or b, if you know which slot is activefastboot reboot fastbootd # If availablefastboot getvar all # Look for super_partition_sizefastboot read super super.imgIf
fastbootdis not available orread superfails, you’ll need to extract it from a factory image or a device dump. -
Deconstruct the `super` Image with `lpunpack`
The
lpunpacktool is essential for extracting the contents of asuper.img.lpunpack --output ./extracted_super super.imgThis command will create a directory named
extracted_supercontaining the individual.imgfiles (e.g.,system.img,vendor.img) and alp_metadatafile. Inspect the metadata to understand the original layout:lpunpack --dump-json lp_metadataThis will output a JSON structure detailing the groups, partitions, and their properties. Pay close attention to
maximum_sizefor groups andsizefor individual partitions. Note the block size (often 4096 bytes) and metadata size (e.g., 65536 bytes) which are crucial for re-creating the image.
Designing Your Custom Partition Layout
The core of this lab is defining your desired partition layout. Common scenarios include:
- Increasing the size of
systemfor larger GApps or custom binaries. - Shrinking
vendorto free up space for other partitions. - Adding a new logical partition (e.g.,
user_storage,aosp_build) for specific purposes.
Based on the lpunpack --dump-json lp_metadata output, you’ll create a new JSON file (e.g., custom_layout.json) that dictates the structure for lpmake. The structure typically looks like this:
{
Android Mobile Specs & Compare Directory
Are you researching mobile hardware properties, processor SoCs, GPU chipsets, or RAM configurations? Access our complete specs catalog to compare up to 5 devices side-by-side!
Compare Devices Specs →