← 返回命令列表

Linux command

mkfs.erofs 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

mkfs.erofs [image.erofs] [root/]

Example

mkfs.erofs -U [UUID] [image.erofs] [root/]

Example

mkfs.erofs -zlz4hc [image.erofs] [root/]

Example

mkfs.erofs --all-root [image.erofs] [root/]

说明

mkfs.erofs creates EROFS (Enhanced Read-Only File System) images from a directory tree. EROFS is a lightweight read-only filesystem designed for performance-sensitive scenarios like Android system partitions, container images, and embedded systems. The filesystem supports transparent compression, enabling significant space savings while maintaining fast random read access. Unlike SquashFS, EROFS provides better random access performance due to its fixed-size block design. Output is a file containing the complete filesystem image, suitable for mounting via loopback or writing to a read-only partition.

参数

-U _uuid_
Set a specific filesystem UUID
-z _algorithm_
Enable compression (lz4, lz4hc, lzma, deflate, zstd)
--all-root
Make all files owned by root (UID/GID 0)
-L _label_
Set the volume label
-T _timestamp_
Use a fixed timestamp for all files (reproducible builds)
--exclude-path _pattern_
Exclude files matching the pattern
-E _options_
Extended options for fine-tuning

FAQ

What is the mkfs.erofs command used for?

mkfs.erofs creates EROFS (Enhanced Read-Only File System) images from a directory tree. EROFS is a lightweight read-only filesystem designed for performance-sensitive scenarios like Android system partitions, container images, and embedded systems. The filesystem supports transparent compression, enabling significant space savings while maintaining fast random read access. Unlike SquashFS, EROFS provides better random access performance due to its fixed-size block design. Output is a file containing the complete filesystem image, suitable for mounting via loopback or writing to a read-only partition.

How do I run a basic mkfs.erofs example?

Run `mkfs.erofs [image.erofs] [root/]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -U _uuid_ do in mkfs.erofs?

Set a specific filesystem UUID