iso-snapshot – Is it possible to enhance xz-compression to “-9”?

Forum Forums General Tips and Tricks iso-snapshot – Is it possible to enhance xz-compression to “-9”?

  • This topic has 4 replies, 3 voices, and was last updated Dec 11-7:54 pm by BitJam.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30484
    Member
    Xaver

      The default value for xz compression is “-6”. The strongest (and slowest) setting is -9. Is it possible to set xz compression in iso-snapshot to “-9”? I have tried to do that via environment variable in .profile and /etc/bash.bashrc.

      XZ_OPT=-9             (also tried XZ_OPT="-9", XZ_OPT=-1, XZ_OPT="-1")
      export XZ_OPT

      But the compression rate did not change, no matter which value I have chosen. Is there a different solution?

      #30489
      Anonymous
        Helpful
        Up
        0
        ::

        Doing so yields a grossly inefficient result (discovered when I tested a while back)
        but if you care to find out firsthand, to see for yerself…

        edit the configuration file /etc/iso-snapshot.conf
        and therein declare your desired options.
        isosnapshot parses the mksq_opt line and, without validating or manipulating your declaration, passes the string to mksquashfs. No extra-quoting of values should be necessary; just use the same syntax as you would when directly calling mksquashfs.

        Before you dive in, I recommend that you first read
        https://jonathancarter.org/2015/04/06/squashfs-performance-testing/

        In case you don’t recognize the name, Jonathan Carter was a 2019 Debian Project Leader candidate.
        Articles throughout his blog at jonathancarter.org are quite informative, as well as his instructional videos
        playlist (60+ videos): Debian Package of the Day

        #30504
        Member
        Xaver
          Helpful
          Up
          0
          ::

          @ skidoo – Thank you

          Does a higher compression level simply mean to get a larger block size? ––>
          -6 = block size 131072
          -7 = block size 262144
          -8 = block size 524288
          -9 = block size 1048576

          Then the following setting would give me xz compression with level -9:
          mksq_opt=-comp xz -b 1048576

          Is that true?

          According to Jonathan Carter level 9 would be about 8% smaller than level 6 and would take about 28% longer to be compressed.
          The larger block size would also slow down the live system.

          #30508
          Anonymous
            Helpful
            Up
            0
            ::

            “Is that true?”
            Yes it is, according to the mksquashfs manpage.
            You might also wish to investigate the effect from tweaking the mksquashfs -Xdict-size option.

            #30513
            Forum Admin
            BitJam
              Helpful
              Up
              0
              ::

              There are two different block sizes. I believe the mksquashfs block size is the size of the different compressed chunks inside the file. If the entire file were compressed in one chunk (like in in a compressed tar file) then most files would take ages to read. Squashfs gets its speed by doing the compression in chunks. A larger blocksize gives you better compression but could slow down random access. As skidoo mentioned, the mksquashfs -Xdict-size option controls the xz dictionary size which seems to be equivalent to controlling the xz compression. But the xz man page warns:

              “The selected compression settings determine the memory requirements of the decompressor, thus using a too high preset level might make it painful to decompress the file on an old system with little RAM. Specifically, it’s not a good idea to blindly use -9 for everything like it often is with gzip and bzip2.”

              If you can find a way to get better compression without sacrificing decompression speed, that would be awesome!

              Context is worth 80 IQ points -- Alan Kay

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.