-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
[PoC] Use EROFS as default filesystem for OpenWrt #9968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
af568b2 to
ce8baca
Compare
|
I just ran a quick test comparing the size of erofs and squashfs. For the same rootfs directory, the erofs file was 14 MB, the squashfs file only 11 MB. |
|
Could you please elaborate on the test you performed? I'm wondering if the default EROFS LZMA compression is simply not as high as what we use for squashfs. |
|
I configured erofs to use lzma at maximum compression level by using -zlzma,9 |
|
there are quite a few options, just tested some block-sizes and a single timestamp for all files and no xattr https://www.kernel.org/doc/html/latest/filesystems/erofs.html has some interesting things like |
still quite a difference - so |
|
Thank you for testing, I got some email feedback from the developer and he recommended squashfs for now. I'll keep erofs in mind for the future. EDIT: I just did, now the storage difference for x86/64 rootfs is 3.6MB (erofs) vs 3.3MB (squashfs). |
|
with |
|
Is there a way to check how much RAM {squashfs4,erofs} kernel module needs? If RAM usage of erofs is much lower than squashfs4 it might still be good for limited RAM/plenty ROM devices. |
not sure but I Attempted to boot openwrt with this patch on a wdr4300 but it didn't boot, have to take a look again - poc works in qemu so this should be enough to get an idea and some data. The EROFS paper talks about improvements vs. squashfs: https://www.usenix.org/system/files/atc19-gao.pdf (section 2.2) but not sure how much of this applies to openwrt. |
|
I asked on the erofs mailing list and they're working on improvements regarding size. I'd just leave this PR open and update it from time to time, this way people can run tests without duplicating the work. It surely takes another year or so to become the default, if ever :)
Please report all finding in this PR
Sorry for the inconvenience! |
no worries! super cool that we have something to experiment and if it's not a good fit at least we tried :) thanks for your time working on this - I try to gather more data when I have some time again. |
Just notice this topic, but that is not simple. EROFS strategy is to reuse page cache rather than allocate bounced compressed buffers if suitable, so the whole benefit is reduced runtime temp buffers, the final Instead, EROFS will cache some compressed data if needed if available memory is abundant since no need to trigger I/O anymore (if you use I guess it can be observed by Also, MicroLZMA is still an experimental feature compared to LZ4, partially due to no stable XZ utils released yet, partially since I still have some remaining runtime tuning work to do for such slow algorithms. I didn't prioritize that also due to no new stable XZ utils till now. |
|
I wonder if, aside from size increase problem, this fs would give us other benefits... Improvement to the boot time? |
|
I’ll make a note that @stintel was wondering about reworking the whole thing using btrfs and subvolumes. Never got anywhere. |
|
I'm very interested in moving to EROFS as well but unfortunately this didn't not on mt7621 either :( I think with the right settings you could probably get very close to squashfs in size and I'd welcome it if this became a FS to choose from |
So yhea compression still needs some love |
|
It'd probably be worth giving the option to use it since EROFS is supposed to be noticeably quicker and there's plenty of devices that do have enough storage. My proposal would be to keep squashfs as default but give an EROFS option while configuring the build. https://github.com/erofs/erofs-openbenchmark/wiki/linux_5.10_rc4-compression-FSes-benchmark |
|
@timocapa i agree... if there are real benefits and someone doesn't care about the extra space than it seems a nice idea to me making erofs an alternative fs |
|
Certainly good enough for me :p That said that'll be impossible for me to make work since I'm not a dev :( |
|
I'll work on that |
|
@Ansuel could you please help me backport the outstanding Kernel patches that add tailpacking? |
|
@aparcar mhhh sure just tell me what you need :D Where can i find the patches? |
5f8ed58 to
e82e369
Compare
This allows the usage of MicroLZMA usable by erofs. Signed-off-by: Paul Spooren <mail@aparcar.org>
needed for mkfs.erofs Signed-off-by: Paul Spooren <mail@aparcar.org>
Signed-off-by: Paul Spooren <mail@aparcar.org>
Signed-off-by: Paul Spooren <mail@aparcar.org>
It is now possible to select erofs as rootfs if Kernel 5.15 is selected. Signed-off-by: Paul Spooren <mail@aparcar.org>
|
@Ansuel I think it needs everything erofs related up until 5.17. |
|
@aparcar oh so we need to backport each patch made to erofs? tedious work! |
|
@Ansuel honestly I don't know, I can ask upstream devs what's really needed, I thought you may have a nice script which simplifies backports |
|
@aparcar unfortunately no script :( |
|
If lzma is a hard requirement (which to be fair does save ~1 MB) backports are needed - lz4(hc) should work OK with 5.15 I don't know if this would be allowed, but otherwise I would just do the whole EROFS kernel backporting in a single patch Other than that you do need xz updates as well if lzma |
|
@timocapa mhhh single patch backport are scary and a mess to handle with kernel bump. I prefer a well split patchset |
|
@Ansuel We can also wait for the next Linux LTS release to be supported on OpenWrt, already includes lzma (Sorry for the previous comment that i deleted, i thought 5.19 was LTS) |
|
@timocapa are you sure 6.0 will be LTS? I expect a 6.1 version till December at least. We are at rc4, can't take that long for a stable release. I mean if we really want I can experiment with adding 6.0 support to openwrt ehehehehhe |
|
jesus my github app mad freaked out @Ansuel Nah I'm not sure however it would fit the release cycle of what i know (every .5), but I've edited the post to say "Next LTS" instead We can also just skip lzma for now and make LZ4(HC) work, lzma should be a drop in replacement for it (and if not we would still have the basic setup to use) |
|
So 6.0 has been out for a week now, what's the plan? :p |
|
@timocapa none for now? openwrt supports only LTS version and the next LTS is 6.1... anyway i have added support for 6.0 on openwrt but currently i only ported ipq806x |
|
You had mentioned "I can experiment with adding 6.0 support to openwrt", so I was curious :) |
|
Delivered :D https://git.openwrt.org/?p=openwrt/staging/ansuel.git;a=shortlog;h=refs/heads/test-6.0 |
|
This might be helpful in understanding why squashfs might always be smaller but perform slower: Squashfs has larger chunksizes like 128KiB which increases compression but since they are variable your read speed suffers. EROFS limits itself to one chunk size only: 4KiB block size. Limiting Squashfs to 4KiB appears to produce smaller output than erofs still so there is likely room for improvement. (the article tested outlandishly larger partitions in the gigabytes, so this might not apply to 6MiB images) EROFS definitely has a few advantages over squashfs but I'm not sure it justifies running two types of filesystems in parallel on a release. (Squashfs will likely remain the default for low flash devices, I think) |
|
@Djfe the 6.0 testing branch got updated to 6.1... and 6.1 will be introduced when we will branch for a new release |
|
erofs-utils 1.6 is released, could you check this with Linux 6.1/6.2 [1]? [1] https://github.com/hsiangkao/erofs-utils/blob/dev/docs/PERFORMANCE.md |
|
@Ansuel would you mind helping me with some backporting ;)? |
|
@aparcar sure! what can we use to coordinate? |
|
Is someone else excited to take care of this? Kernel 6.6 is around the corner so less back porting is needed anyway. |
|
@aparcar did we understood if we should target 6.1 or 6.6? |
|
Whatever you think is best :) |
This is a proof of concept to use EROFS for OpenWrt.
Based on little research it seems to outperform SquashFS regarding speed and storage.
The MicroLZMA (incomplete backport) may allow to save some extra space.
Tested and works with x86/64 QEMU:
Image filenames still contain squashfs however run an EROFS filesystem.