ArticleslgStudy

science

EROFS

EROFS is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand EROFS rather than just read about it. In short: EROFS (Enhanced Read-Only File System) is a modern immutable (read-only) file system for the Linux kernel. It was initially proposed by Huawei to address the performance and memory-use limitations of SquashFS on Android smartphones.

Key takeaways

  • EROFS belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect EROFS to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of EROFS from memory before moving on to harder problems.

Reference excerpt

EROFS (Enhanced Read-Only File System) is a modern immutable (read-only) file system for the Linux kernel. It was initially proposed by Huawei to address the performance and memory-use limitations of SquashFS on Android smartphones. It is now maintained by an international open-source file system community. EROFS and its userspace tools, receive contributions from developers at Alibaba Group, ByteDance, Coolpad, DeepSeek, Docker, Google, Huawei, NVIDIA, OPPO, Red Hat, Shanghai Jiao Tong University, Tencent, vivo, Xiaomi, and more. EROFS is designed for operating-system images, container images, application sandboxes, virtual-machine snapshot images, and dataset distribution. It combines a compact, block-based format with optional transparent compression, data deduplication, and native layering, aiming to balance storage efficiency with read performance and memory use. Its security design minimizes redundant metadata and requires the implementation to handle corrupt or deliberately crafted images without compromising kernel safety. EROFS has been available in the Linux kernel since Linux 5.4.

Features

Core features EROFS supports Unix ownership and permissions, hard links, symbolic links, device nodes, extended file attributes, and POSIX access-control lists. Extended attributes can be stored inline or shared between inodes. Uncompressed file data is block-aligned, except for inline data, allowing memory mapping, direct I/O, and filesystem direct access (DAX) where supported by the backing device. Small files and file tails can be stored alongside inode metadata. Optional 48-bit block addressing, supported since Linux 6.15, permits filesystem capacities of up to 1 EiB with 4 KiB blocks.

Compression Compression is optional and can be selected per inode. Supported algorithms include LZ4, MicroLZMA (since Linux 5.16), DEFLATE (since Linux 6.6), and Zstandard (since Linux 6.10). Optional metadata compression has been supported since Linux 6.17. Hardware-accelerated DEFLATE decompression using Intel QuickAssist Technology has been supported since Linux 6.16. EROFS primarily uses fixed-size output compression, compressing variable amounts of input into block-aligned physical clusters. In-place decompression reduces temporary buffering. Larger physical clusters can improve compression ratios, with potential costs in memory use and random-access performance. File tails can be inlined into metadata or packed together as fragments in a special inode.

Deduplication Uncompressed inodes can share fixed-size data chunks. Compressed inodes can share variable-size extents, with rolling hashes used during image creation to identify reusable data and adjust extent boundaries. Both mechanisms allow portions of files to be shared without requiring the entire files to be identical.

Mounting and layering EROFS images can be mounted from block devices or, since Linux 6.12, directly from regular files without a loop device. An earlier fscache-based mechanism was introduced in Linux 5.19 and deprecated in Linux 6.12. It was removed in Linux 7.2. Inodes can reference external data on additional block devices or in file blobs, allowing images to share payloads. Native sub-filesystem merging can combine external payloads into a single filesystem view, using either a composite device or multiple backing devices. Explicit multiple-device support was introduced in Linux 5.16. OverlayFS can provide a writable layer over an immutable EROFS image.

Memory optimizations Since Linux 7.0, inode-based page-cache sharing, enabled with the inode_share mount option, allows inodes with identical content fingerprints to share cached file data. Sharing across mounts requires a common private domain identifier (domain_id), which is treated as sensitive and omitted from mount information. Large folios are supported for uncompressed inodes since Linux 6.2 and compressed inodes since Linux 6.11.

On-disk format

Layout EROFS uses a little-endian format whose core metadata consists of a superblock, inodes, and directory entries. The superblock begins at byte offset 1024. Inodes and directories do not require centralized tables, allowing metadata and file data to be interleaved and arranged for incremental image construction. Inodes use either a 32-byte compact layout or a 64-byte extended layout. Compact inodes have 32-bit file-size fields and 16-bit user and group identifiers. Extended inodes have 64-bit file-size fields, 32-bit identifiers, and individual nanosecond-resolution timestamps. Directory entries are sorted lexicographically by filename within each directory block. The core format supports uncompressed images, while features such as compression and chunk-based data layouts are optional extensions. Compressed inode and shared extended-attribute metadata can be stored through a hidden inode called the metabox.

Handling of crafted images The Linux kernel's general threat model treats bugs triggered by mounting corrupt or maliciously crafted filesystem images as ordinary bugs rather than security vulnerabilities, unless the filesystem is explicitly documented as hardened against hostile inputs. Mounting a block device is a privileged operation, and administrators are responsible for the media they mount. The EROFS on-disk format is designed with corrupt and deliberately crafted images in scope. The format minimizes redundant metadata representations to reduce cross-structure consistency invariants that the implementation must validate for runtime safety. Its safety requirement is that malformed metadata may produce invalid filesystem contents or errors, but its effects must remain confined to the data and metadata exposed to userspace. Upstream EROFS development therefore requires implementation hardening against crafted images, a stricter policy than the general Linux filesystem threat model.

Adoption

Android EROFS is used for read-only system partitions on Android devices from manufacturers including Coolpad, Honor, Huawei, Motorola, Samsung, OPPO, Xiaomi, and vivo. The Android Open Source Project supports building EROFS partition images and using them with Virtual A/B updates.

Container images Composefs, the EROFS snapshotter for containerd, and Dragonfly Nydus use EROFS for immutable image storage and distribution. EROFS is also supported by gVisor and Kata Containers.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with EROFS

Start with the simplest possible case. Write down what EROFS claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to EROFS before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about EROFS ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of EROFS

In research
EROFS appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses EROFS in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
EROFS is common in secondary-school and first-year university syllabi. It links to neighbouring topics Compression file systems, Embedded Linux, File systems supported by the Linux kernel, so understanding it makes those chapters shorter.
In everyday life
Look for EROFS outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “EROFS” →

How to study EROFS in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what EROFS means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain EROFS out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is EROFS in simple terms?

EROFS (Enhanced Read-Only File System) is a modern immutable (read-only) file system for the Linux kernel. It was initially proposed by Huawei to address the performance and memory-use limitations of SquashFS on Android smartphones.

Why does EROFS matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study EROFS?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on EROFS.

Tags

  • Compression file systems
  • Embedded Linux
  • File systems supported by the Linux kernel
  • Free special-purpose file systems
  • Read-only file systems supported by the Linux kernel

Keep exploring