Skip to content

Commit 3eea45b

Browse files
authored
Merge pull request #12485 from erofs/erofs-fixes
update EROFS snapshotter documentation
2 parents 60f15df + 77644a1 commit 3eea45b

1 file changed

Lines changed: 59 additions & 39 deletions

File tree

docs/snapshotters/erofs.md

Lines changed: 59 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
# EROFS Snapshotter
22

3-
The [EROFS](https://erofs.docs.kernel.org) snapshotter is an experimental
4-
feature, which is able to leverage EROFS-formatted blobs for each committed
5-
snapshot and prepares an EROFS + OverlayFS mount for each active snapshot.
6-
7-
In order to leverage EROFS-formatted blobs, the EROFS differ is needed to be
8-
used together to apply image layers. Otherwise, the EROFS snapshotter will
9-
just behave as the existing OverlayFS snapshotter: the default applier will
10-
unpack the image layer into the active EROFS snapshot, and commit it.
11-
12-
Although it sounds somewhat similar to an enhanced OverlayFS snapshotter but
13-
I believe there are clear differences if looking into `s.mount()` and it highly
14-
tightens to the EROFS internals. Currently, it's not quite clear to form an
15-
enhanced OverlayFS snapshotter directly, and (I think) it's not urgent since
16-
in the very beginning, it'd be better to be left as an independent snapshotter
17-
so that existing overlayfs users won't be impacted by the new behaviors and
18-
users could have a chance to try and develop the related ecosystems (such as
19-
ComposeFS, confidential containers, gVisor, Kata, gVisor, and more) together.
3+
The [EROFS](https://erofs.docs.kernel.org) snapshotter is a native containerd
4+
snapshotter to enable the EROFS filesystem, specifically to keep EROFS‑formatted
5+
blobs for each committed snapshot and to prepare an OverlayFS mount for each
6+
active snapshot.
7+
8+
Although the EROFS snapshotter sounds somewhat similar to an enhanced OverlayFS
9+
snapshotter, several kernel features are highly tied to the EROFS internals, so
10+
it would be better to leave it as an independent snapshotter. This way, existing
11+
OverlayFS users will not be impacted by the new EROFS‑specific behaviors, and
12+
interested users will also have a chance to use the EROFS filesystem and even
13+
develop the related ecosystems (such as ComposeFS, confidential containers,
14+
gVisor, Kata, nerdbox and more) together.
2015

2116
## Use Cases
2217

@@ -28,16 +23,27 @@ on the backing filesystem, it applies OCI layers into EROFS blobs, therefore:
2823
- Improved image unpacking performance (~14% for WordPress image with the
2924
latest erofs-utils 1.8.2) due to reduced metadata overhead;
3025

26+
- Parallel unpacking is now supported natively, similar to the OverlayFS
27+
snapshotter. This capability is difficult to implement in
28+
disk‑snapshot‑style snapshotters such as blockfile, devmapper and ZFS
29+
snapshotters. It also uses an efficient method to persist layer data (via
30+
fsync) compared to the OverlayFS snapshotter, which can only use syncfs;
31+
32+
- Support given‑size block devices as the upper layer for OverlayFS to
33+
limit the disk quota for writable layers (usually ephemeral storage);
34+
35+
- A dedicated EROFS default mount handler enables EROFS file‑backed mounts
36+
to avoid loop devices on runC. Note that specific runtime shims can
37+
handle EROFS mounts without this built‑in handler; for more details, see
38+
[containerd Mounts and Mount Management](../mounts.md);
39+
3140
- Full data protection for each snapshot using the FS_IMMUTABLE_FL file
3241
attribute and fsverity. EROFS uses FS_IMMUTABLE_FL and fsverity to protect
3342
each EROFS layer blob, ensuring the mounted tree remains immutable. However,
3443
since FS_IMMUTABLE_FL and fsverity protect individual files rather than a
3544
sub-filesystem tree, other snapshotter implementations like the overlayfs
3645
snapshotter are not quite applicable due to less efficiency at least;
3746

38-
- Parallel unpacking can be supported in a more reliable way (fsync) compared
39-
to the overlayfs snapshotter (syncfs);
40-
4147
- Native EROFS layers can be pulled from registries without conversion.
4248

4349
For VM containers, the EROFS snapshotter can efficiently pass through and share
@@ -50,20 +56,6 @@ pass-through.
5056

5157
## Usage
5258

53-
### Checking if the EROFS snapshotter and differ are available
54-
55-
To check if the EROFS snapshotter is available, run the following command:
56-
57-
```bash
58-
$ ctr plugins ls | grep erofs
59-
```
60-
61-
The following message will be shown like below:
62-
```
63-
io.containerd.snapshotter.v1 erofs linux/amd64 ok
64-
io.containerd.differ.v1 erofs linux/amd64 ok
65-
```
66-
6759
### Ensure that EROFS filesystem is available
6860

6961
On newer Ubuntu/Debian systems, erofs-utils can be installed directly using the
@@ -78,8 +70,23 @@ $ dnf install erofs-utils
7870

7971
Make sure that erofs-utils version is 1.7 or higher.
8072

81-
Before using EROFS snapshotter, also make sure the _EROFS kernel module_ is
82-
loaded (Linux 5.4 or later is required): it can be loaded with `modprobe erofs`.
73+
When using the EROFS snapshotter, before starting containerd, also make sure
74+
the _EROFS kernel module_ is loaded (Linux 5.4 or later is required): it can be
75+
loaded with `modprobe erofs`.
76+
77+
### Checking if the EROFS snapshotter and differ are available
78+
79+
To check if the EROFS snapshotter is available, run the following command:
80+
81+
```bash
82+
$ ctr plugins ls | grep erofs
83+
```
84+
85+
The following message will be shown like below:
86+
```
87+
io.containerd.snapshotter.v1 erofs linux/amd64 ok
88+
io.containerd.differ.v1 erofs linux/amd64 ok
89+
```
8390

8491
### Configuration
8592

@@ -128,6 +135,17 @@ $ # run the container with the provides snapshotter
128135
$ ctr run -rm -t --snapshotter erofs docker.io/library/busybox:latest hello sh
129136
```
130137

138+
## Quota Support
139+
140+
EROFS supports block mode to generate fixed‑size virtual blocks as the upper
141+
layers for overlayfs with a given filesystem formatted in order enable the disk
142+
quota. The `default_size` option can be used in the containerd configuration:
143+
144+
```toml
145+
[plugins."io.containerd.snapshotter.v1.erofs"]
146+
default_size = "20GiB"
147+
```
148+
131149
## Data Integrity
132150

133151
The EROFS snapshotter provides two methods to consolidate data integrity:
@@ -221,6 +239,8 @@ For the EROFS differ:
221239

222240
## TODO
223241

224-
The EROFS Fsmerge feature is NOT supported in the current implementation
225-
because it was somewhat unclean (relying on `containerd.io/snapshot.ref`).
226-
It needs to be reconsidered later.
242+
- EROFS Flatten filesystem support (EROFS fsmerge feature);
243+
244+
- ID-mapped mount spport;
245+
246+
- DMVerity support.

0 commit comments

Comments
 (0)