pub/scm/linux/kernel/git/xiang/erofs-utils.git  about / heads / tags
Userspace utilities for linux-erofs file system
$ git log --pretty=format:'%h %s (%cs)%d'
83d94dc erofs-utils: release 1.7.1 (2023-10-20)
	(HEAD -> master, tag: v1.7.1)
8300aab erofs-utils: fix reference leak in erofs_mkfs_build_tree_from_path() (2023-10-20)
8cbc205 erofs-utils: mkfs: fix corrupted directories with hardlinks (2023-10-17)
c0b5c3d erofs-utils: errno shouldn't set to a negative value in lib/tar.c (2023-10-08)
8ee0743 erofs-utils: Fix cross compile with autoconf (2023-10-08)
ce36273 erofs-utils: release 1.7 (2023-09-21)
	(tag: v1.7)
0670719 erofs-utils: fix the previous pcluster CBLKCNT missing for big pcluster dedupe (2023-09-21)
86ac79f erofs-utils: fix build error when `-Waddress-of-temporary` is on (2023-09-21)
96c4a82 erofs-utils: mkfs: limit total shared xattrs of a single inode (2023-09-21)
cf3b15d erofs-utils: manpages: update new options of mkfs.erofs (2023-09-21)
...

$ git cat-file blob HEAD:README
erofs-utils
===========

Userspace tools for EROFS filesystem, currently including:

  mkfs.erofs    filesystem formatter
  erofsfuse     FUSE daemon alternative
  dump.erofs    filesystem analyzer
  fsck.erofs    filesystem compatibility & consistency checker as well
                as extractor


EROFS filesystem overview
-------------------------

EROFS filesystem stands for Enhanced Read-Only File System.  It aims to
form a generic read-only filesystem solution for various read-only use
cases instead of just focusing on storage space saving without
considering any side effects of runtime performance.

Typically EROFS could be considered in the following use scenarios:
  - Firmwares in performance-sensitive systems, such as system
    partitions of Android smartphones;

  - Mountable immutable images such as container images for effective
    metadata & data access compared with tar, cpio or other local
    filesystems (e.g. ext4, XFS, btrfs, etc.)

  - FSDAX-enabled rootfs for secure containers (Linux 5.15+);

  - Live CDs which need a set of files with another high-performance
    algorithm to optimize startup time; others files for archival
    purposes only are not needed;

  - and more.

Note that all EROFS metadata is uncompressed by design, so that you
could take EROFS as a drop-in read-only replacement of ext4, XFS,
btrfs, etc. without any compression-based dependencies and EROFS can
bring more effective filesystem accesses to users with reduced
metadata.

For more details of EROFS filesystem itself, please refer to:
https://www.kernel.org/doc/html/next/filesystems/erofs.html

For more details on how to build erofs-utils, see `docs/INSTALL.md`.

For more details about filesystem performance, see
`docs/PERFORMANCE.md`.


mkfs.erofs
----------

Two main kinds of EROFS images can be generated: (un)compressed images.

 - For uncompressed images, there will be none of compresssed files in
   these images.  However, it can decide whether the tail block of a
   file should be inlined or not properly [1].

 - For compressed images, it'll try to use the given algorithms first
   for each regular file and see if storage space can be saved with
   compression. If not, fallback to an uncompressed file.

How to generate EROFS images (LZ4 for Linux 5.3+, LZMA for Linux 5.16+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Currently lz4(hc) and lzma are available for compression, e.g.
 $ mkfs.erofs -zlz4hc foo.erofs.img foo/

Or leave all files uncompressed as an option:
 $ mkfs.erofs foo.erofs.img foo/

In addition, you could specify a higher compression level to get a
(slightly) better compression ratio than the default level, e.g.
 $ mkfs.erofs -zlz4hc,12 foo.erofs.img foo/

Note that all compressors are still single-threaded for now, thus it
could take more time on the multiprocessor platform. Multi-threaded
approach is already in our TODO list.

How to generate EROFS big pcluster images (Linux 5.13+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In order to get much better compression ratios (thus better sequential
read performance for common storage devices), big pluster feature has
been introduced since linux-5.13, which is not forward-compatible with
old kernels.

In details, -C is used to specify the maximum size of each big pcluster
in bytes, e.g.
 $ mkfs.erofs -zlz4hc -C65536 foo.erofs.img foo/

So in that case, pcluster size can be 64KiB at most.

Note that large pcluster size can cause bad random performance, so
please evaluate carefully in advance. Or make your own per-(sub)file
compression strategies according to file access patterns if needed.

How to generate EROFS images with multiple algorithms (Linux 5.16+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It's possible to generate an EROFS image with files in different
algorithms due to various purposes.  For example, LZMA for archival
purposes and LZ4 for runtime purposes.

In order to use alternative algorithms, just specify two or more
compressing configurations together separated by ':' like below:
    -zlzma:lz4hc,12:lzma,9 -C32768

Although mkfs still choose the first one by default, you could try to
write a compress-hints file like below:
    4096  1 .*\.so$
    32768 2 .*\.txt$
    4096    sbin/.*$
    16384 0 .*

and specify with `--compress-hints=` so that ".so" files will use
"lz4hc,12" compression with 4k pclusters, ".txt" files will use
"lzma,9" compression with 32k pclusters, files  under "/sbin" will use
the default "lzma" compression with 4k plusters and other files will
use "lzma" compression with 16k pclusters.

Note that the largest pcluster size should be specified with the "-C"
option (here 32k pcluster size), otherwise all larger pclusters will be
limited.

How to generate well-compressed EROFS images
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Even if EROFS is not designed for such purposes in the beginning, it
could still produce some smaller images (not always) compared to other
approaches with better performance (see `docs/PERFORMANCE.md`).  In
order to build well-compressed EROFS images, try the following options:
 -C1048576                     (5.13+)
 -Eztailpacking                (5.16+)
 -Efragments / -Eall-fragments ( 6.1+);
 -Ededupe                      ( 6.1+).

Also EROFS uses lz4hc level 9 by default, whereas some other approaches
use lz4hc level 12 by default.  So please explicitly specify
`-zlz4hc,12 ` for comparison purposes.

How to generate legacy EROFS images (Linux 4.19+)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Decompression inplace and compacted indexes have been introduced in
Linux v5.3, which are not forward-compatible with older kernels.

In order to generate _legacy_ EROFS images for old kernels,
consider adding "-E legacy-compress" to the command line, e.g.

 $ mkfs.erofs -E legacy-compress -zlz4hc foo.erofs.img foo/

For Linux kernel >= 5.3, legacy EROFS images are _NOT recommended_
due to runtime performance loss compared with non-legacy images.

Obsoleted erofs.mkfs
~~~~~~~~~~~~~~~~~~~~

There is an original erofs.mkfs version developed by Li Guifu,
which was replaced by the new erofs-utils implementation.

git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git -b obsoleted_mkfs

PLEASE NOTE: This version is highly _NOT recommended_ now.


erofsfuse
---------

erofsfuse is introduced to support EROFS format for various platforms
(including older linux kernels) and new on-disk features iteration.
It can also be used as an unpacking tool for unprivileged users.

It supports fixed-sized output decompression *without* any in-place
I/O or in-place decompression optimization. Also like the other FUSE
implementations, it suffers from most common performance issues (e.g.
significant I/O overhead, double caching, etc.)

Therefore, NEVER use it if performance is the top concern.

How to mount an EROFS image with erofsfuse
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As the other FUSE implementations, it's quite easy to mount by using
erofsfuse, e.g.:
 $ erofsfuse foo.erofs.img foo/

Alternatively, to make it run in foreground (with debugging level 3):
 $ erofsfuse -f --dbglevel=3 foo.erofs.img foo/

To debug erofsfuse (also automatically run in foreground):
 $ erofsfuse -d foo.erofs.img foo/

To unmount an erofsfuse mountpoint as a non-root user:
 $ fusermount -u foo/


dump.erofs and fsck.erofs
-------------------------

dump.erofs and fsck.erofs are used to analyze, check, and extract
EROFS filesystems. Note that extended attributes and ACLs are still
unsupported when extracting images with fsck.erofs.

Note that fragment extraction with fsck.erofs could be slow now and
it needs to be optimized later.  If you are interested, contribution
is, as always, welcome.


Contribution
------------

erofs-utils is a part of EROFS filesystem project, which is completely
community-driven open source software.  If you have interest in EROFS,
feel free to send feedback and/or patches to:
  linux-erofs mailing list   <linux-erofs@lists.ozlabs.org>


Comments
--------

[1] According to the EROFS on-disk format, the tail blocks of files
    could be inlined aggressively with their metadata (called
    tail-packing) in order to minimize the extra I/Os and the storage
    space.

# heads (aka `branches'):
$ git for-each-ref --sort=-creatordate refs/heads \
	--format='%(HEAD) %(refname:short) %(subject) (%(creatordate:short))'
  experimental erofs-utils: lib: drop prefix_sha256 digests (2024-05-28)
  dev          erofs-utils: lib: fix uncompressed packed inode (2024-05-23)
  experimental-tests-fscache erofs-utils: tests: add fscache/014 (2024-01-02)
  experimental-tests erofs-utils: update .gitignore for test results and tools (2023-11-24)
* master       erofs-utils: release 1.7.1 (2023-10-20)
  experimental-mt erofs-utils: fsck: work3 (2023-02-14)
  experimental-fuzzer erofs-utils: add a prelimitary fuzzer (2019-08-19)
  obsoleted_mkfs erofs-utils: correct --with-lz4 example in README (2019-06-01)

# tags:
$ git for-each-ref --sort=-creatordate refs/tags \
	--format='%(refname:short) %(subject) (%(creatordate:short))'
v1.7.1       erofs-utils: release 1.7.1 (2023-10-20) tar.gz
v1.7         erofs-utils: release 1.7 (2023-09-21) tar.gz
v1.6         erofs-utils: release 1.6 (2023-03-12) tar.gz
v1.5         erofs-utils: release 1.5 (2022-06-13) tar.gz
v1.4         erofs-utils: release 1.4 (2021-11-22) tar.gz
v1.3         erofs-utils: release 1.3 (2021-06-01) tar.gz
v1.2.1       erofs-utils: release 1.2.1 (2021-01-10) tar.gz
v1.2         erofs-utils: release 1.2 (2020-12-06) tar.gz
v1.1         erofs-utils: release 1.1 (2020-04-14) tar.gz
v1.0         erofs-utils: release 1.0 (2019-10-24) tar.gz

# associated public inboxes:
# (number on the left is used for dev purposes)
       1247 linux-erofs
         32 lkml
         25 fstests
         19 linux-xfs
         15 linux-btrfs
         14 linux-unionfs
          8 linux-ext4
          7 qemu-devel
          6 linux-fsdevel
          6 linux-arm-kernel
          6 linuxppc-dev
          5 linux-devicetree
          5 stable
          5 linux-gpio
          5 dpdk-dev
          5 dri-devel
          4 linux-wireless
          4 linux-mtd
          4 linux-block
          4 linux-nfs
          4 linux-mm
          4 netdev
          4 linux-media
          4 xen-devel
          4 linux-mips
          4 linux-input
          4 linux-iio
          4 linux-pci
          4 linux-mmc
          4 intel-gfx
          4 linux-kbuild
          3 linux-riscv
          3 linux-iommu
          3 linux-pm
          3 linux-rtc
          3 alsa-devel
          3 linux-usb
          3 selinux
          3 linux-clk
          3 linux-security-module
          3 linux-serial
          3 linux-watchdog
          3 linux-trace-devel
          3 backports
          3 linux-api
          3 linux-spi
          3 linux-sparse
          3 lttng-dev
          3 ceph-devel
          3 linux-arch
          3 linux-can
          3 u-boot
          3 buildroot
          3 intel-wired-lan
          3 qemu-riscv
          3 reiserfs-devel
          2 linux-samsung-soc
          2 linux-nvme
          2 bpf
          2 linux-mediatek
          2 linux-crypto
          2 linux-acpi
          2 netfilter-devel
          2 linux-cifs
          2 linux-arm-msm
          2 linux-amlogic
          2 linux-scsi
          2 kvmarm
          2 driverdev-devel
          2 linux-renesas-soc
          2 linux-kselftest
          2 linux-rdma
          2 linux-leds
          2 linux-f2fs-devel
          2 kvm
          2 linux-modules
          2 linux-rt-users
          2 linux-bluetooth
          2 linux-ide
          2 util-linux
          2 linux-doc
          2 git
          2 linux-man
          2 amd-gfx
          2 linux-omap
          2 linux-audit
          2 linux-i2c
          2 linux-pwm
          2 linux-tegra
          2 virtualization
          2 containers
          2 linux-rockchip
          2 linux-raid
          2 openbmc
          2 linux-fbdev
          2 linux-cxl
          2 linux-perf-users
          2 linux-sh
          2 nouveau
          2 linux-s390
          2 linux-coco
          2 iwd
          2 ltp
          2 yocto
          2 yocto-meta-freescale
          2 openembedded-core
          2 yocto-toaster
          2 yocto-meta-arm
          2 openembedded-devel
          2 bitbake-devel
          2 yocto-meta-virtualization
          2 yocto-meta-ti
          2 yocto-meta-arago
          2 outreachy
          2 openrisc
          2 kexec
          2 intel-xe
          2 linux-um
          2 virtio-comment
          2 poky
          2 cluster-devel
          2 grub-devel
          2 kvm-ppc
          2 linux-hexagon
          2 lvm-devel
          2 virtio-fs
          2 ../../../../../../../fuego
          2 ../../../../../../../igt-dev
          1 linux-fscrypt
          1 cocci
          1 live-patching
          1 linux-efi
          1 linux-integrity
          1 linux-edac
          1 linux-nvdimm
          1 linux-snps-arc
          1 linux-hwmon
          1 kernel-hardening
          1 dmaengine
          1 linux-next
          1 linux-parisc
          1 kernelnewbies
          1 linux-sgx
          1 linux-hyperv
          1 workflows
          1 rcu
          1 selinux-refpolicy
          1 linux-m68k
          1 linux-i3c
          1 linux-spdx
          1 linux-wpan
          1 ksummit-discuss
          1 wireguard
          1 io-uring
          1 linux-kernel-mentees
          1 linux-csky
          1 tpmdd-devel
          1 linux-firmware
          1 cip-dev
          1 linux-remoteproc
          1 linux-dash
          1 linux-bcache
          1 mm-commits
          1 linux-fpga
          1 xdp-newbies
          1 platform-driver-x86
          1 phone-devel
          1 linux-hardening
          1 dash
          1 dm-devel
          1 keyrings
          1 linux-sctp
          1 target-devel
          1 lustre-devel
          1 soc
          1 ocfs2-devel
          1 rust-for-linux
          1 ath10k
          1 ath11k
          1 linux-phy
          1 kernel-janitors
          1 sparclinux
          1 linux-staging
          1 linux-sunxi
          1 mptcp
          1 regressions
          1 ksummit
          1 b43-dev
          1 nvdimm
          1 linux-nfc
          1 linux-bcachefs
          1 ath9k-devel
          1 ntfs3
          1 llvm
          1 fio
          1 ell
          1 ofono
          1 yocto-docs
          1 linux-patches
          1 chrome-platform
          1 ntb
          1 xenomai
          1 damon
          1 asahi
          1 loongarch
          1 imx
          1 ath12k
          1 b4-sent
          1 linux-trace-kernel
          1 oe-linux-nfc
          1 oe-kbuild-all
          1 oe-chipsec
          1 batman
          1 virtio-dev
          1 v9fs
          1 ecryptfs
          1 linux-ia64
          1 kbd
          1 autofs
          1 cpufreq
          1 dccp
          1 cgroups
          1 devicetree-spec
          1 devicetree-compiler
          1 initramfs
          1 hail-devel
          1 kvm-ia64
          1 linux-8086
          1 kernel-testers
          1 linux-alpha
          1 linux-btrace
          1 linux-embedded
          1 linux-hams
          1 linux-hotplug
          1 linux-laptop
          1 linux-sound
          1 trinity
          1 linux-metag
          1 linux-x25
          1 linux-nilfs
          1 lvs-devel
          1 netfilter
          1 linux-oxnas
          1 u-boot-amlogic
          1 lm-sensors
          1 acpica-devel
          1 perfbook
          1 smatch
          1 ../../../../../../../wireless-regdb
          1 ../../../../../../../powertop

git clone https://yhbt.net/lore/pub/scm/linux/kernel/git/xiang/erofs-utils.git