Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Is it a good idea to compress rootfs in live-iso using zstd instead of gzip? #820

@hksdpc255

Description

@hksdpc255

Is your feature request related to a problem? Please describe.
There is a hard-coded gzip compression at line 95:

args := []string{
"mksquashfs",
tmpPaths[clrRootfs],
tmpPaths[clrCdroot] + "/images/rootfs.img",
"-b",
"131072",
"-comp",
"gzip",
"-e",
"boot/",
"-e",
"proc/",
"-e",
"sys/",
"-e",
"dev/",
"-e",
"run/",
}

Lots of benchmarks shows that zstd decompresion speed is much faster than gzip even using compression level 22:
https://gist.github.com/baryluk/70a99b5f26df4671378dd05afef97fce

Describe the solution you'd like
Zstd with compression level 22 will make the rootfs.img smaller but it will consume more memory when the kernel decompress it.

	args := []string{
		"mksquashfs",
		tmpPaths[clrRootfs],
		tmpPaths[clrCdroot] + "/images/rootfs.img",
		"-b",
		"131072",
		"-comp",
		"zstd",
		"-Xcompression-level",
		"22",
		"-e",
		"boot/",
		"-e",
		"proc/",
		"-e",
		"sys/",
		"-e",
		"dev/",
		"-e",
		"run/",
	}

Describe alternatives you've considered
Zstd with compression level 19 will make the rootfs.img small and fast, consuming resonable memory.

	args := []string{
		"mksquashfs",
		tmpPaths[clrRootfs],
		tmpPaths[clrCdroot] + "/images/rootfs.img",
		"-b",
		"131072",
		"-comp",
		"zstd",
		"-Xcompression-level",
		"19",
		"-e",
		"boot/",
		"-e",
		"proc/",
		"-e",
		"sys/",
		"-e",
		"dev/",
		"-e",
		"run/",
	}

Additional context
Currently, zstd support for mksquashfs in ClearLinux seems broken. clearlinux/distribution#3235
But I still believe compress rootfs using zstd is good for both performance and disk usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions