EROFS

{{Short description|Read-only file system for Linux}}

{{Infobox filesystem

| name = EROFS

| developer = Huawei originally, Alibaba Cloud, Bytedance, Coolpad, Google, OPPO, Red Hat, Shanghai Jiao Tong University, VIVO, Uniontech, South China University of Technology

| full_name = Enhanced Read-Only File System

| introduction_date = {{Start date|2019|11|24}}

| introduction_os = Linux 5.4

| partition_id =

| directory_struct =

| file_struct =

| bad_blocks_struct =

| max_file_size = {{Plainlist|

  • 4 GiB (compact)
  • 16 EiB (extended, also limited by volume size){{Cite web|title=erofs.html|url=https://www.kernel.org/doc/html/v5.19/filesystems/erofs.html|website=www.kernel.org|author=Gao Xiang|access-date=2022-08-04}}

}}

| max_files_no = Depends on volume size

| max_filename_size = 255 bytes

| max_volume_size = 1 EiB since 6.15

| filename_character_set =

| dates_recorded = File change time (extended only)

| date_range =

| date_resolution = 1 ns

| forks_streams =

| attributes = POSIX, Extended file attributes

| file_system_permissions = POSIX, ACL

| compression = Yes (LZ4; LZMA since 5.16; DEFLATE since 6.6)

| data_deduplication = Yes (extent-based)

| encryption =

| single_instance_storage =

| OS = Linux

}}

EROFS (Enhanced Read-Only File System) is a lightweight read-only file system initially developed by Huawei, originally for the Linux kernel and now maintained by an open-source community.

EROFS aims to form a generic read-only file system solution for various read-only use cases (embedded devices, containers and more) instead of just focusing on storage space saving without considering any side effects of runtime performance.

For example, it provides a solution to save storage space by using transparent compression as an option for scenarios that need high-performance read-only

requirements on their devices with limited hardware resources, e.g. smartphones like Android and IoT operating systems such as HarmonyOS alongside its HarmonyOS NEXT core system iteration.{{Cite web|title=There Is Finally A User-Space Utility To Make EROFS Linux File-Systems|url=https://www.phoronix.com/scan.php?page=news_item&px=Linux-EROFS-User-Space|website=Phoronix|author=Michael Larabel|date=2018-11-19|access-date=2018-12-13}}{{Cite mailing list|title=erofs: introduce erofs file system|url=https://lkml.org/lkml/2018/5/31/306|date=2018-05-31|access-date=2018-12-13|mailing-list=Linux kernel|last=Xiang|first=Gao}}

All of Huawei's new products shipped with EMUI 9.0.1 or later used EROFS,{{Cite mailing list|title=erofs: promote erofs from staging|url=https://lkml.org/lkml/2019/7/4/435|date=2019-07-04|access-date=2019-09-03|mailing-list=Linux kernel|last=Xiang|first=Gao}} and it was promoted as one of the key features of EMUI 9.1.{{Cite web|title=EMUI 9.1, the Intelligent Android OS|url=https://consumer.huawei.com/levant/emui-9-1/|publisher=Huawei Technologies|website=HUAWEI Global|access-date=2022-01-10}} Oppo, Xiaomi and some Samsung products also use EROFS.{{Cite web|title=Google's plan to use EROFS on Android|date=20 May 2022 |url=https://blog.esper.io/android-dessert-bites-25-erofs-in-android-13-47987123/|access-date=2022-08-04}}{{Cite web|title=The Galaxy S23 might be Samsung's first Android device to use EROFS|date=2023-02-07|url=https://www.realmicentral.com/2023/02/07/the-galaxy-s23-might-be-samsungs-first-android-device-to-use-erofs|access-date=2023-07-22}}

Also, it provides a content-addressable chunk-based container image solution together with lazy pulling feature to accelerate container startup speed by using new file-based fscache backend since Linux kernel v5.19 and file-backed mounts since v6.12.{{Cite web|url=https://d7y.io/blog/2022/06/06/evolution-of-nydus/|title=The Evolution of the Nydus Image Acceleration|date=6 June 2022 |access-date=2022-08-04}}{{Cite web |title=The 6.12 merge window begins [LWN.net] |url=https://lwn.net/Articles/990750/ |access-date=2025-04-13 |website=lwn.net}}

The file system was formally merged into the mainline kernel with Linux kernel v5.4.{{Cite web|url=https://lwn.net/Articles/805462/|title=The 5.4 kernel has been released|author=corbet|date=2019-11-25|website=LWN.net|access-date=2019-12-01}}

Features

The file system has two different inode on-disk layouts. One is compact, and the other is extended.

  • Little-endian on-disk design
  • 48-bit block addressing, which currently limits the total possible capacity of an EROFS filesystem to 1 EiB of 4 KiB block size.
  • Metadata and data can be mixed by design for on-disk flexibility together with tail-packing inline data technology
  • Support POSIX attributes and permissions, extended file attributes and ACL
  • Fixed-size output transparent compression with LZ4, MicroLZMA (since Linux 5.16{{Cite web|title=EROFS File-System Adding LZMA Compression Support Via New MicroLZMA|url=https://www.phoronix.com/scan.php?page=news_item&px=EROFS-LZMA-Compression|website=Phoronix|author=Michael Larabel|access-date=2022-01-10}}), zstd and/or DEFLATE (since Linux 6.6{{Cite web|title=EROFS File-System Adding DEFLATE Compression Support|url=https://www.phoronix.com/news/EROFS-DEFLATE-Coming|website=Phoronix|author=Michael Larabel|access-date=2023-09-03}}) for relative higher compression ratios
  • In-place decompression for higher sequential read {{Cite web|title=staging: erofs: introduce LZ4 decompression inplace|url=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/staging?id=0ffd71bcc3a03ebb3551661a36052488369c4de9|access-date=2020-12-03}}{{Cite web|title=staging: erofs: integrate decompression inplace|url=https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/staging?id=b6a76183dea8df67d5888493afe4181e260fad95|access-date=2020-12-03}}
  • Big pcluster feature allowing up to 1 MiB big pclusters for better compression ratios since Linux 5.13.{{Cite web|title=EROFS Sends In "Big Pcluster" Support For Linux 5.13, Other Improvements|url=https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.13-EROFS|website=Phoronix|author=Michael Larabel|access-date=2021-07-11}}{{Cite web|title=erofs: add big pcluster compression support|url=https://lwn.net/Articles/851388/|access-date=2021-07-11}}
  • Direct I/O, Direct Access (DAX) support, chunk-based data deduplication for uncompressed files since Linux 5.15.{{Cite web|title=XFS & EROFS File-Systems Have Big Changes For Linux 5.15|url=https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.15-XFS-EROFS|website=Phoronix|author=Michael Larabel|access-date=2021-11-02}}
  • Multiple device support for multiple layer container images since Linux 5.16.
  • Ztailpacking support since Linux 5.17.{{Cite web|title=EROFS-Utils 1.5 Released With ZTailPacking, FSCK Extraction|url=https://www.phoronix.com/news/EROFS-Utils-1.5-Released|access-date=2022-08-04}}
  • File-based Fscache backend support since Linux 5.19 with "on-demand mode".{{Cite web|title=5.19 Merge window, part 1|url=https://lwn.net/Articles/896140/|author=Jonathan Corbet|access-date=2022-08-04}}{{Cite web|title=Linux Kernel 5.19 Officially Released, Linus Torvalds Teases Linux 6.0 as Next Kernel Series|url=https://9to5linux.com/linux-kernel-5-19-officially-released-this-is-whats-new|author=Marius Nestor|date=31 July 2022 |access-date=2022-08-04}}
  • Rolling hash deduplicated data compression and fragment support since Linux 6.1.

See also

  • cramfs
  • ext4 - previously Huawei used this file system for its system partitions
  • SquashFS

References

{{Reflist}}