Use 1m as new default squashfs block size
authorMichael Prokop <mika@grml.org>
Wed, 10 Mar 2021 08:29:41 +0000 (09:29 +0100)
committerMichael Prokop <mika@grml.org>
Wed, 10 Mar 2021 09:08:12 +0000 (10:08 +0100)
The default block size of mksquashfs is 128k, while we used 256k since 2009.
When increasing the block size further, we increase build time, but also
decrease the file size (and therefore the resulting ISO).

Nowadays rotating media (CD/DVD) aren't so much in usage anymore, while
(USB) flash drives and direct ISO boot (both from disk as well as via
OOB management) are way more common. Latency maybe is no longer so
relevant as it used to be, so let's see if this turns out to be a
problem. On the other side smaller ISOs decrease download times as well
as disk usage (esp. when used as /boot/grml via grml-rescueboot).
Overall it is a trade off that's worth consideration, let's give it a try.

Some non-scientific benchmarks give the following build times:

* block size 256k: 2min 19sec, 383MB
* block size 1m:   3min 30sec, 363MB

Buffer/cache memory usage of the booted ISO slightly increases (91MB
used and 170MB buff/cache with block size 1m, vs. 94MB used and 143MB
buff/cache with block size 256kb), but might be neglectable. (And once
again, this was another non-scientific benchmark.)

Further options that might be worth consideration are 1) -Xdict-size
(while -Xdict-size 100% is the default already, so noting really to do
for us here), and 2) `-Xbcj x86`, which further increases compression
time, but also has a bit of savings.

FTR, Jonathan Carter did some benchmarks related to squashfs in 2015, see
https://jonathancarter.org/2015/04/06/squashfs-performance-testing/.
And Fedora is considering usage of `-b 1M -Xdict-size 1M -no-recovery`
(which would be identical to what we have, note that -no-recovery
doesn't seem to influence file size), see
https://fedoraproject.org/wiki/Changes/OptimizeSquashFS

Thanks: Mihai Moldovan <ionic@ionic.de>

etc/grml/grml-live.conf
grml-live

index c84f588..1f9e3ba 100644 (file)
 # SQUASHFS_BINARY='mksquashfs'
 
 # Options that should be used by mksquashfs during build process.
 # SQUASHFS_BINARY='mksquashfs'
 
 # Options that should be used by mksquashfs during build process.
-# Defaults to '-b 256k' and the according LZMA/XZ option.
-# SQUASHFS_OPTIONS='-b 256k'
+# Defaults to '-b 1m' and the according LZMA/XZ option.
+# SQUASHFS_OPTIONS='-b 1m'
 
 # exclude files from compressed squashfs file using the
 # the mksquashfs option -ef:
 
 # exclude files from compressed squashfs file using the
 # the mksquashfs option -ef:
index e0d55f4..a80ebcd 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -1385,8 +1385,8 @@ else
 
    # use sane defaults if $SQUASHFS_OPTIONS isn't set
    if [ -z "$SQUASHFS_OPTIONS" ] ; then
 
    # use sane defaults if $SQUASHFS_OPTIONS isn't set
    if [ -z "$SQUASHFS_OPTIONS" ] ; then
-     # use blocksize 256k as this gives best result with regards to time + compression
-     SQUASHFS_OPTIONS="-b 256k"
+     # use block size 1m as this gives good result with regards to time + compression
+     SQUASHFS_OPTIONS="-b 1m"
 
      # set lzma/xz compression by default, unless -z option has been specified on command line
      if [ -z "$SQUASHFS_ZLIB" ] ; then
 
      # set lzma/xz compression by default, unless -z option has been specified on command line
      if [ -z "$SQUASHFS_ZLIB" ] ; then