From d34dfc936607fb267e9d2a82af2c97bf1bd903fe Mon Sep 17 00:00:00 2001 From: Simon Boehm Date: Mon, 17 May 2021 20:15:49 +0200 Subject: [PATCH] Add docs for using SquashFS on targets w/o zstd --- conda_pack/formats.py | 11 ++++++++--- docs/source/squashfs.rst | 15 ++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/conda_pack/formats.py b/conda_pack/formats.py index 830e2076..41713db6 100644 --- a/conda_pack/formats.py +++ b/conda_pack/formats.py @@ -402,13 +402,18 @@ def mksquashfs_from_staging(self): cmd += ["-comp", comp_algo_str] else: comp_level = int(self.compress_level / 8 * 20) - comp_algo_str = "zstd level {}".format(comp_level) + comp_algo_str = "zstd (level {})".format(comp_level) # 256KB block size instead of the default 128KB for slightly smaller archive sizes cmd += ["-comp", "zstd", "-Xcompression-level", str(comp_level), "-b", str(256*1024)] if self.verbose: - print("Running mksquashfs (processors: {}, compression: {})".format( - self.n_threads, comp_algo_str)) + s = "Running mksquashfs with {} compression (processors: {}).".format( + comp_algo_str, self.n_threads) + if self.compress_level != 9: + s += "\nWill require kernel>=4.14 or squashfuse>=0.1.101 (compiled with zstd) " \ + "for mounting.\nTo support older systems, compress with " \ + "`xz` (--compress-level 9) instead." + print(s) else: cmd.append("-no-progress") subprocess.check_call(cmd) diff --git a/docs/source/squashfs.rst b/docs/source/squashfs.rst index b1617fab..131edca0 100644 --- a/docs/source/squashfs.rst +++ b/docs/source/squashfs.rst @@ -4,8 +4,7 @@ SquashFS ``conda-pack`` can package environments into `SquashFS `_, a compressed, read-only Linux filesystem. These filesystems can then be mounted directly, without decompressing them first. -This allows benefiting from compressed storage, without the decompression step necessary for the -``zip`` and ``tar.gz`` formats. +This allows using packed environments immediately and without consuming disk space. Packing ------- @@ -73,7 +72,13 @@ Compression options ------------------- Compression can be specified through ``--compress-level``. -Default is level 4. +Default is level 4, which will use ``zstd`` compression. + +When selecting a compression option for packing, keep in mind the kernel or ``squashfuse`` version on the target system. +For older systems, make sure that SquashFS or ``squashfuse`` support ``zstd`` compression +(Linux kernel version ``>=4.14`` or ``squashfuse >= 0.1.101``). +If ``zstd`` isn't supported on the target, you can always compress with ``xz`` instead. + - 0: no compression - 1-8: ``zstd`` with increasing compression level @@ -87,10 +92,10 @@ Sometimes the unpacked environment needs to be writeable on the target machine, more packages. A good way to do this is to use `Union mounting `_ to add a writeable layer on top of the read-only SquashFS. - On Linux the most used option is `OverlayFS `_. -To show how to set this up, we create three layers: +To set this up, we create three layers: + 1. The SquashFS-packed conda env as a read-only lower layer 2. A writeable working directory, necessary for OverlayFS 3. A writeable upper directory, where all new and changed files will go