EROFS (Enhanced Read-Only File System)

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

OffsetSizeTypeFieldNotes
0xC1u8Bits
0x244u32 LEVolume Length

Constants

Erofs Module

NameValueTypeNotes
Magic0xE0F5E1E2uint

—- compressed files (z_erofs) —-

NameValueTypeNotes
CblkCnt0x800intZ_EROFS_LI_D0_CBLKCNT: a NONHEAD delta carrying a big pcluster’s block count
TypePlain0, TypeHead1 = 1, TypeNonHead = 2, TypeHead2 = 3int
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.