mkfs.erofs - Man Page

tool to create an EROFS filesystem


mkfs.erofs [Options] DESTINATION SOURCE


EROFS is a new enhanced lightweight linux read-only filesystem with modern designs (eg. no buffer head, reduced metadata, inline xattrs/data, etc.) for scenarios which need high-performance read-only requirements, e.g. Android OS for smartphones and LIVECDs.

It also provides fixed-sized output compression support, which improves storage density, keeps relatively higher compression ratios, which is more useful to achieve high performance for embedded devices with limited memory since it has unnoticable memory overhead and page cache thrashing.

mkfs.erofs is used to create such EROFS filesystem DESTINATION image file from SOURCE directory.


-z compression-algorithm [,#] [: ... ]

Set a primary algorithm for data compression, which can be set with an optional compression level (1 to 12 for LZ4HC, 0 to 9 for LZMA and 100 to 109 for LZMA extreme compression) separated by a comma.  Alternative algorithms could be specified and separated by colons.

-C max-pcluster-size

Specify the maximum size of compress physical cluster in bytes. It may enable big pcluster feature if needed (Linux v5.13+).

-d #

Specify the level of debugging messages. The default is 2, which shows basic warning messages.

-x #

Specify the upper limit of an xattr which is still inlined. The default is 2. Disable storing xattrs if < 0.

-E extended-option [,...]

Set extended options for the filesystem. Extended options are comma separated, and may take an extra argument using the equals ('=') sign. The following extended options are supported:


Forcely record the whole files into a special inode for better compression and it may take an argument as the pcluster size of the packed inode in bytes. (Linux v6.1+)


Enable global compressed data deduplication to minimize duplicated data in the filesystem. It may be used with -Efragments option together to further reduce image sizes. (Linux v6.1+)


Forcely generate compact inodes (32-byte inodes) to output.


Forcely generate extended inodes (64-byte inodes) to output.


Forcely generate inode chunk format in 4-byte block address array.


Forcely generate inode chunk format in 8-byte chunk indexes (with device id).


Pack the tail part (pcluster) of compressed files or the whole files into a special inode for smaller image sizes, and it may take an argument as the pcluster size of the packed inode in bytes. (Linux v6.1+)


Drop "inplace decompression" and "compacted indexes" support, which is used to generate compatible EROFS images for Linux v4.19 - 5.3.


Don't inline regular files to enable FSDAX for these files (Linux v5.15+).


Pack the tail part (pcluster) of compressed files into its metadata to save more space and the tail part I/O. (Linux v5.17+)

-L volume-label

Set the volume label for the filesystem to volume-label. The maximum length of the volume label is 16 bytes.

-T #

Set all files to the given UNIX timestamp. Reproducible builds requires setting all to a specific one.


Set the universally unique identifier (UUID) of the filesystem to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16".


Make all files owned by root.

--blobdev file

Specify another extra blob device to store chunk-based data.

--chunksize #

Generate chunk-based files with #-byte chunks.

--compress-hints file

If the optional --compress-hints file argument is given, mkfs.erofs uses it to apply the per-file compression strategy. Each line is defined by tokens separated by spaces in the following form.  Optionally, instead of the given primary algorithm, alternative algorithms could be specified with algorithm-index by hand:

<pcluster-in-bytes> [algorithm-index] <match-pattern>


Ignore file that matches the exact literal path. You may give multiple `--exclude-path' options.


Ignore files that match the given regular expression. You may give multiple `--exclude-regex` options.


Specify a file_contexts file to setup / override selinux labels.


Set all file uids to UID.


Set all file gids to GID.


Add GIDOFFSET to all file gids. When this option is used together with --force-gid, the final file gids are set to GID + GID-OFFSET.


Display this help and exit.


File modification time is ignored whenever it would cause mkfs.erofs to use extended inodes over compact inodes. When not using a fixed timestamp, this can reduce total metadata size.

--max-extent-bytes #

Specify maximum decompressed extent size # in bytes.


File modification time is preserved whenever mkfs.erofs decides to use extended inodes over compact inodes.


Add UIDOFFSET to all file uids. When this option is used together with --force-uid, the final file uids are set to UID + UIDOFFSET.


This version of mkfs.erofs is written by Li Guifu <>, Miao Xie <> and Gao Xiang <> with continuously improvements from others.

This manual page was written by Gao Xiang <>.


mkfs.erofs is part of erofs-utils package and is available from git://

See Also


Referenced By