Enhanced Read-Only File System (EROFS) is a type of Linux kernel file system designed for high-performance read-only scenarios. Alibaba Cloud Linux operating systems use EROFS in cloud computing scenarios to better meet the distribution and storage requirements of container images, operating system images, software packages, and AI model datasets. This topic describes the common features of EROFS and how to use EROFS.
Feature comparison
The following table compares the common features of EROFS, Ext4, and SquashFS file systems.
Feature | EROFS | Ext4 | SquashFS |
Minimum block size | 512 bytes | 1 KiB | Not aligned |
Inode size | 32 or 64 bytes | 128 or 256 bytes | Variable based on the file type |
Maximum number of UIDs/GIDs | Unlimited | Unlimited | 65,536 |
Nanosecond timestamp | Yes | Yes | No |
UUID and volume label | Supported | Supported | Not supported |
Data compression | Supported | Not supported | Supported |
Data deduplication | Supported | Not supported | Not supported |
Mount through files | Supported | Not supported | Not supported |
External data reference | Supported | Not supported | Not supported |
POSIX.1e ACL | Supported | Supported | Not supported |
Direct I/O | Supported | Supported | Not supported |
FSDAX | Supported | Supported | Not supported |
FIEMAP | Supported | Supported | Not supported |
SEEK_{DATA,HOLE} support | Supported | Supported | Not supported |
Create and use file system images
Check whether the
erofs-utilspackage is installed.mkfs.erofs -VIf a version number of the package is displayed, the package is installed.
If no version number of the package is displayed, run the following command to install the
erofs-utilspackage:sudo yum install -y erofs-utils
Run the
mkfs.erofscommand to create a file system image.For example, run the following command to create a file system image named
foo.erofsfrom thefoodirectory:mkfs.erofs foo.erofs fooThe following command output is displayed:
mkfs.erofs 1.8.4 Build completed. ------ Filesystem UUID: c11813b0-b657-439c-8484-2196703035b7 Filesystem total blocks: 1 (of 4096-byte blocks) Filesystem total inodes: 1 Filesystem total metadata blocks: 1 Filesystem total deduplicated bytes (of source files): 0The following table describes the parameters of the
mkfs.erofscommand.Parameter
Description
-zX[,level]
The compression algorithm (X, which supports only lowercase letters) and the optional compression level (level). LZ4, LZ4HC, LZMA, DEFLATE, and Zstd algorithms are supported. For example,
-zlz4hc,12specifies the LZ4HC algorithm with the compression level set to 12. If no compression algorithm is specified, an uncompressed image is created.-C <size>
The physical cluster size. Unit: bytes. For example,
-C 65536specifies a 64 KiB cluster size. Appropriately increasing the physical cluster size can reduce the image size and improve sequential read performance, but may affect random read performance.-T <time>
The UNIX timestamp for all files.
-U <UUID>
The file system UUID.
-L <label>
The file system volume label.
Mount the created file system image.
For example, run the following command to mount the
foo.erofsfile system image to the/mnt/erofsdirectory:sudo mkdir -p /mnt/erofs sudo mount -t erofs -o loop foo.erofs /mnt/erofsIf you no longer use the file system, unmount the file system.
For example, run the following command unmount the file system mounted at the
/mnt/erofsdirectory:sudo umount /mnt/erofs