LinuxCommandLibrary

sqfstar

Analyze StarCraft: Brood War replay files

TLDR

Create a squashfs filesystem (compressed using gzip by default) from an uncompressed tar archive

$ sqfstar [filesystem.squashfs] < [archive.tar]
copy

Create a squashfs filesystem from a tar archive compressed with gzip, and [comp]ress the filesystem using a specific algorithm
$ zcat [archive.tar.gz] | sqfstar -comp [gzip|lzo|lz4|xz|zstd|lzma] [filesystem.squashfs]
copy

Create a squashfs filesystem from a tar archive compressed with xz, excluding some of the files
$ xzcat [archive.tar.xz] | sqfstar [filesystem.squashfs] [file1 file2 ...]
copy

Create a squashfs filesystem from a tar archive compressed with zstd, excluding files ending with .gz
$ zstdcat [archive.tar.zst] | sqfstar [filesystem.squashfs] "[*.gz]"
copy

Create a squashfs filesystem from a tar archive compressed with lz4, excluding files matching a regex
$ lz4cat [archive.tar.lz4] | sqfstar [filesystem.squashfs] -regex "[regex]"
copy

SYNOPSIS

sqfstar {-c|--create} <SQUASHFS_FILE> <TAR_FILE> [OPTIONS]
sqfstar {-x|--extract} <SQUASHFS_FILE> <TAR_FILE> [OPTIONS]
sqfstar {-h|--help}
sqfstar {-V|--version}

PARAMETERS

-c, --create
    Creates a SquashFS image from the specified tar archive. The first argument is the output SquashFS file, and the second is the input tar file.

-x, --extract
    Extracts the content of a SquashFS image into a tar archive. The first argument is the input SquashFS file, and the second is the output tar file.

-z, --compression
    Sets the compression algorithm for the SquashFS image. Supported values include lz4, xz, zstd, gzip, and none.

-k, --block-size
    Specifies the compression block size in bytes (e.g., 65536, 131072, 262144, 524288, 1048576). Larger blocks often yield better compression but require more memory.

-f, --force
    Forces sqfstar to overwrite the output file if it already exists without prompting.

-q, --quiet
    Suppresses progress output during operation, showing only errors or critical information.

-v, --verbose
    Enables verbose output, providing more detailed information about the process.

-V, --version
    Displays the sqfstar version information and exits.

-h, --help
    Displays a help message with usage information and exits.

-p, --processors
    Specifies the number of processors or threads to use for parallel compression, if supported by the chosen algorithm.

-X
    Passes extra, compressor-specific options to the selected compression algorithm (e.g., -Xcompression-level=9 for xz).

DESCRIPTION

sqfstar is a utility from the squashfs-tools-ng project, designed to facilitate the creation of SquashFS images directly from tar archives, and the extraction of existing SquashFS images back into tar archives. It acts as a bridge, allowing for efficient packaging and unpackaging of filesystem content between these two common archive formats.

Unlike traditional SquashFS tools that operate on directories, sqfstar directly processes tar files, making it suitable for scenarios where data is already packaged or needs to be streamed. It supports various compression algorithms and block sizes, providing flexibility for optimizing image size and performance. This command is particularly useful in embedded systems, live environments, or any context requiring compact, read-only file systems derived from or convertible back into tar archives.

CAVEATS

sqfstar is part of the squashfs-tools-ng project, which is a newer and less ubiquitous alternative to the standard squashfs-tools package found in most Linux distributions. Users should ensure they have the squashfs-tools-ng package installed to use this command. Its streaming capabilities with standard input/output are not explicitly documented in the typical help output but may be inferred from its design for tar file handling. It's crucial to specify the correct operation mode (create or extract) and provide valid file paths for both the SquashFS image and the tar archive.

HISTORY

The sqfstar command emerged as part of the squashfs-tools-ng project, an initiative to provide more modern and flexible tools for handling SquashFS images. While traditional SquashFS utilities like mksquashfs and unsquashfs primarily operate on directories, squashfs-tools-ng introduced sqfstar to specifically address the need for direct interaction between SquashFS images and tar archives.

This allows for workflows where data is already packaged in a tar format or needs to be output as such, streamlining operations for embedded systems, continuous integration pipelines, or situations requiring efficient streaming of archive content without intermediate directory extraction. Its development reflects an effort to extend SquashFS utility beyond traditional filesystem-to-image conversions.

SEE ALSO

mksquashfs(1), unsquashfs(1), tar(1), squashfs(5)

Copied to clipboard