#9127 A method to reduce the installation media size by 140MiB and/or build time
Opened 7 months ago by bkhomuts. Modified 6 months ago

As of Fedora 31, the LiveOS/squashfs.img file on the installation image, is compressed with default settings of mksquashfs. The standard configuration is set to XZ algorithm with block size of 128k with BCJ filter enabled. Those parameters can be adjusted which will lead to a better compression ratio and/or reduction of the CPU usage at build time.

This is simple to achieve. Recently, Lorax has gotten support[1] for adjusting the compression options for mksquashfs. The configuration file should be altered as following:

bcj = yes
args = -b 1M -Xdict-size 1M -no-recovery

Where -b 1M and -Xdict-size 1M are block and dictionary sizes respectively. Could be adjusted.

Even better savings could be achieved in case of removing an EXT4 filesystem layer. Plain SquashFS is supported by both Lorax and dracut. But I was unable to boot the image

I made experiments to scope the trade-off of build time versus saved space on installation media. The results can be viewed on the picture below.
Full log file can be accessed at https://pastebin.com/pxe76nYX

I also performed the initial installation test, but with Red Hat Enterprise Linux 7, to confirm that the memory usage during installation stays within minimum requirement of 2GB.

As an optional requirement, the Pungi utility could be modified to allow specifying of custom Lorax configuration file (-c option of lorax).

  • When do you need this? (YYYY/MM/DD)
    Not applicable. I'd like to have this solution in Fedora 32.

  • When is this no longer needed or useful? (YYYY/MM/DD)
    Not applicable.

  • If we cannot complete your request, what is the impact?
    The image will be compressed with sub-optimal compression configuration. The cost of distributing Fedora will be higher than it could be.

[1] https://github.com/weldr/lorax/commit/361c6de2deac987c3e29f9e77363d111feba0f18

Rev. 1.1, Dec 27th: update attached table with more experiments.

Bohdan Khomutskyi

Release Configuration Management engineer
Red Hat

Maybe post this to the Fedora's devel list instead?

Yeah, a devel list discussion would be good. Thanks for looking into this!

Also, there is https://pagure.io/releng/issue/8646 which is related?

Miro, Kevin, thanks for sharing your opinions.

I posted the change proposal to the development mailing list: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/L6ZQCOYXZOIIOZM7SUFQDGEUEQU2QY7N/.

I also attached the change proposal itself as a file to this comment. I was not able to create an article in wiki system.

Bohdan Khomutskyi

Release Configuration Management engineer
Red Hat

Seems to relate to these issues:

"installations from Live images use excessive client CPU on /dev/loop1" #8581
"Create Fedora LiveOS images using plain squashfs root filesystem" #8646
"modify koji to that it can accept configurable rootfs image type" koji#1622

Chris, thanks for mentioning the tickets above, this change actually relates to the issues you mentioned.

I filed the change proposal at https://fedoraproject.org/wiki/Category:Changes/OptimizeSquashFS.

I'll run more benchmarks, including using Zstd compression algorithm, and will post results.
Hopefully this weekend, I'll also try to measure the impact of the compression versus installation time.

Also, the decompression of SquashFS is currently happening in single thread. This could be changed with CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU kernel build-time configuration option. I'll file a new change proposal for it, along with benchmarks.

More benchmarking results are available at https://fedoraproject.org/wiki/Category:Changes/OptimizeSquashFS, including the 'plain' SquashFS filesystem.
After performing the tests, I personally recommend to use xz compression with 1MiB block size, without bcj, on a 'plain' squash filesystem -- this will lead to a reduction of 142MiB on the ISO, compared to the stock Fedora 31 Workstation x86_64 image.
Alternative compression options, such as Zstd, are also mentioned in the change proposal.

Select re-packaged ISOs of Fedora 31 Workstation x86-64 is available for download at https://khomutsky.com/fedora-dvd/

Login to comment on this ticket.

Attachments 2