SQFSTAR(1) User Commands SQFSTAR(1)

sqfstar - tool to create a squashfs filesystem from a tar archive


cat xxx.tar | sqfstar [OPTIONS] FILESYSTEM [exclude files]
zcat xxx.tgz | sqfstar [OPTIONS] FILESYSTEM [exclude files]
xzcat xxx.tar.xz | sqfstar [OPTIONS] FILESYSTEM [exclude files]
zstdcat xxx.tar.zst | sqfstar [OPTIONS] FILESYSTEM [exclude files]

Squashfs is a highly compressed read-only filesystem for Linux. It uses either gzip/xz/lzo/lz4/zstd compression to compress both files, inodes and directories. Inodes in the system are very small and all blocks are packed to minimise data overhead. Block sizes greater than 4K are supported up to a maximum of 1Mbytes (default block size 128K).

Squashfs is intended for general read-only filesystem use, for archival use (i.e. in cases where a .tar.gz file may be used), and in constrained block device/memory systems (e.g. embedded systems) where low overhead is needed.

set data block to BLOCK_SIZE. Default 128 Kbytes. Optionally a suffix of K or M can be given to specify Kbytes or Mbytes respectively.
select COMP compression. Compressors available: gzip (default), lzo, lz4, xz, zstd, lzma.
do not compress inode table.
do not compress the uid/gid table (implied by -noI).
do not compress data blocks.
do not compress fragment blocks.
do not compress extended attributes.
do not compress any of the data or metadata. This is equivalent to specifying -noI -noD -noF and -noX.

build filesystems that are reproducible (default).
build filesystems that are not reproducible.
set filesystem creation timestamp to TIME. TIME can be an unsigned 32-bit int indicating seconds since the epoch (1970-01-01) or a string value which is passed to the "date" command to parse. Any string value which the date command recognises can be used such as "now", "last week", or "Wed Feb 15 21:02:39 GMT 2023".
set all file timestamps to TIME. TIME can be an unsigned 32-bit int indicating seconds since the epoch (1970-01-01) or a string value which is passed to the "date" command to parse. Any string value which the date command recognises can be used such as "now", "last week", or "Wed Feb 15 21:02:39 GMT 2023".
set root directory time to TIME. TIME can be an unsigned 32-bit int indicating seconds since the epoch (1970-01-01) or a string value which is passed to the "date" command to parse. Any string value which the date command recognises can be used such as "now", "last week", or "Wed Feb 15 21:02:39 GMT 2023".
set root directory permissions to octal MODE.
set root directory owner to specified VALUE, VALUE can be either an integer uid or user name.
set root directory group to specified VALUE, VALUE can be either an integer gid or group name.
make all files owned by root.
set all file uids to specified VALUE, VALUE can be either an integer uid or user name.
set all file gids to specified VALUE, VALUE can be either an integer gid or group name.
tar files often do not store permissions for intermediate directories. This option sets the default directory permissions to octal MODE, rather than 0755. This also sets the root inode mode.
tar files often do not store uids for intermediate directories. This option sets the default directory owner to UID, rather than the user running Sqfstar. This also sets the root inode uid.
tar files often do not store gids for intermediate directories. This option sets the default directory group to GID, rather than the group of the user running Sqfstar. This also sets the root inode gid.
make pseudo file uids and gids override -all-root, -force-uid and -force-gid options.
make the filesystem exportable via NFS.
do not detect sparse files.
do not use fragments.
do not pack tail ends into fragments.
do not perform duplicate checking.
do not hardlink files, instead store duplicates.

add pseudo file definition. The definition should be quoted.
add list of pseudo file definitions. Pseudo file definitions in pseudo-files should not be quoted.
list of exclude dirs/files. One per line.
allow POSIX regular expressions to be used in exclude dirs/files.
allow tar files to be concatenated together and fed to Sqfstar. Normally a tarfile has two consecutive 512 byte blocks filled with zeros which means EOF and Sqfstar will stop reading after the first tar file on encountering them. This option makes Sqfstar ignore the zero filled blocks.

do not store extended attributes.
store extended attributes (default).
exclude any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g. -xattrs-exclude '^user.' excludes xattrs from the user namespace.
include any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g. -xattrs-include '^user.' includes xattrs from the user namespace.
add the xattr NAME with VAL to files. If an user xattr it will be added to regular files and directories (see man 7 xattr). Otherwise it will be added to all files. VAL by default will be treated as binary (i.e. an uninterpreted byte sequence), but it can be prefixed with 0s, where it will be treated as base64 encoded, or prefixed with 0x, where val will be treated as hexidecimal. Additionally it can be prefixed with 0t where this encoding is similar to binary encoding, except backslashes are specially treated, and a backslash followed by 3 octal digits can be used to encode any ASCII character, which obviously can be used to encode control codes. The option can be repeated multiple times to add multiple xattrs.

print version, licence and copyright message.
force Sqfstar to write to block device or file.
treat normally ignored errors as fatal.
no verbose output.
print files written to filesystem.
do not display the progress bar.
display progress bar when using the -info option.
display a percentage rather than the full progress bar. Can be used with dialog --gauge etc.
throttle the I/O input rate by the given percentage. This can be used to reduce the I/O and CPU consumption of Sqfstar.
limit the I/O input rate to the given percentage. This can be used to reduce the I/O and CPU consumption of Sqfstar (alternative to -throttle).
use NUMBER processors. By default will use number of processors available.
use SIZE physical memory for caches. Use K, M or G to specify Kbytes, Mbytes or Gbytes respectively.
use PERCENT physical memory for caches. Default 25%.
print default memory usage in Mbytes.

do not pad filesystem to a multiple of 4K.
skip OFFSET bytes at the beginning of FILESYSTEM. Optionally a suffix of K, M or G can be given to specify Kbytes, Mbytes or Gbytes respectively. Default 0 bytes.
synonym for -offset.

alternative name for mkfs-time.
alternative name for -all-root.
alternative name for -noI.
alternative name for -noId.
alternative name for -noD.
alternative name for -noF.
alternative name for -noX.
output this options text to stdout.
output this options text to stdout.
print compressor options for selected compressor.

create a directory.
modify filename.
create a block device.
create a character device.
create file from stdout of command.
create a symbolic link.
create a socket (s) or FIFO (f).
create an extended attribute.
create a hard-link to linkname.
same, but link to pseudo file.
create a directory with timestamp time.
modify a file with timestamp time.
create block device with timestamp time.
create char device with timestamp time.
create file with timestamp time.
create symlink with timestamp time.
create socket/fifo with timestamp time.

COMPRESSION-LEVEL should be 1 .. 9 (default 9).
WINDOW-SIZE should be 8 .. 15 (default 15).
Compress using strategy1,strategy2,...,strategyN in turn and choose the best compression. Available strategies: default, filtered, huffman_only, run_length_encoded and fixed.

Where ALGORITHM is one of: lzo1x_1, lzo1x_1_11, lzo1x_1_12, lzo1x_1_15, lzo1x_999 (default).
COMPRESSION-LEVEL should be 1 .. 9 (default 8) Only applies to lzo1x_999 algorithm.

Compress using LZ4 High Compression.

Compress using filter1,filter2,...,filterN in turn (in addition to no filter), and choose the best compression. Available filters: x86, arm, armthumb, powerpc, sparc, ia64.
Use DICT-SIZE as the XZ dictionary size. The dictionary size can be specified as a percentage of the block size, or as an absolute value. The dictionary size must be less than or equal to the block size and 8192 bytes or larger. It must also be storable in the xz header as either 2^n or as 2^n+2^(n+1). Example dict-sizes are 75%, 50%, 37.5%, 25%, or 32K, 16K, 8K etc.

COMPRESSION-LEVEL should be 1 .. 22 (default 15).

(no options) (deprecated - no kernel support)

If set, this is used as the filesystem creation timestamp. Also any file timestamps which are after SOURCE_DATE_EPOCH will be clamped to SOURCE_DATE_EPOCH. See https://reproducible-builds.org/docs/source-date-epoch/ for more information.

Create a Squashfs filesystem from the uncompressed tar file "archive.tar". Sqfstar will use the default compressor (normally gzip), and block size of 128 Kbytes.
Create a Squashfs filesystem from the compressed tar file "archive.tgz". Sqfstar will use the default compressor (normally gzip), and block size of 128 Kbytes.
Use a block size of 1 Mbyte and Zstandard compression to create the filesystem.
Tar files do not supply a definition for the root directory, and the default is to make the directory owned/group owned by the user running Sqfstar. The above command sets the ownership/group ownership to root.
The default permissions for the root directory is 0777 (rwxrwxrwx). The above command sets the permissions to 0755 (rwxr-xr-x).
Exclude file1 and file2 from the tar file when creating filesystem.
Exclude any files in the top level directory which matches the wildcard pattern "*.gz".
Exclude any file which matches the wildcard pattern "*.gz" anywhere within the tar file. The initial "..." indicates the wildcard pattern is "non-anchored" and will match anywhere.

Note: when passing wildcarded names to Sqfstar, they should be quoted (as in the above examples), to ensure that they are not processed by the shell.

Create a directory called "build_dir" in the output filesystem.
Create a reference called "version.txt" to a file not in the tar archive, which acts as if that file was in the tar archive.
Create a file called "date.txt" which holds the output (stdout) from running the "date" command.
As above, but, showing that filenames can have spaces, if they are quoted. The quotes need to be blackslashed to protect them from the shell.
Create a file containing the contents of partition /dev/sda1". The above allows input from these special files to be captured and placed in the Squashfs filesystem.

Note: pseudo file definitions should be quoted (as in the above examples), to ensure that they are passed to Mksquashfs as a single argument, and to ensure that they are not processed by the shell.

Written by Phillip Lougher <phillip@squashfs.org.uk>

Copyright © 2023 Phillip Lougher <phillip@squashfs.org.uk>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

mksquashfs(1), unsquashfs(1), sqfscat(1)

The README for the Squashfs-tools 4.6.1 release, describing the new features can be read here https://github.com/plougher/squashfs-tools/blob/master/README-4.6.1

The Squashfs-tools USAGE guide can be read here https://github.com/plougher/squashfs-tools/blob/master/USAGE-4.6

March 2023 sqfstar version 4.6.1