EROFS is a read-only Linux file system with fixed-size compression, developed at Huawei (Linux 5.4) and used by Android 10 and later for system, vendor and product partitions. It is actively developed.
Overview
EROFS uses a superblock at byte offset 1024 and compact or extended inodes. Compression is applied to fixed-size output clusters (for example 4 KiB blocks), so reading one block never needs to decompress a large stream. Supported algorithms include LZ4 and LZMA. Files may be stored inline in the inode or in separate blocks, and chunk-based layouts allow sharing data blocks.
History
- Developed at Huawei; merged into Linux staging in 4.19 (2018) and into the main tree in 5.4.
- Adopted by Android 10 for system partitions.
Structures
Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
Probe
| Offset | Size | Type | Field | Notes |
|---|---|---|---|---|
| 0xC | 1 | u8 | Bits | |
| 0x24 | 4 | u32 LE | Volume Length |
Constants
Erofs Module
| Name | Value | Type | Notes |
|---|---|---|---|
| Magic | 0xE0F5E1E2 | uint |
—- compressed files (z_erofs) —-
| Name | Value | Type | Notes |
|---|---|---|---|
| CblkCnt | 0x800 | int | Z_EROFS_LI_D0_CBLKCNT: a NONHEAD delta carrying a big pcluster’s block count |
| TypePlain | 0, TypeHead1 = 1, TypeNonHead = 2, TypeHead2 = 3 | int |