SQFSTAR(1)
πΈ SQFSTAR β the sqfstar(1) glow-up π
okay bestie, welcome to SQFSTAR, a User Command, and it's literally the moment your tar archive becomes a whole entire squashfs filesystem. no cap.
β¨ NAME β¨
sqfstar β a tool to create a squashfs filesystem from a tar archive π
π¦ SYNOPSIS π¦
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]
so basically you pipe a tar into it and it goes brrr into a FILESYSTEM. the way that works is so iconic π«Ά
π DESCRIPTION π
Squashfs is a highly compressed read-only filesystem for Linux, and it's giving main character energy fr fr. 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 β and the default block size is 128K, iykyk.
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. lowkey it does it all π
β OPTIONS β
π₯ Filesystem compression options:
-b BLOCK-SIZEβ set data block to BLOCK-SIZE. Default128Kbytes. Optionally a suffix ofK,KB,KbytesorM,MB,Mbytescan be given to specify Kbytes or Mbytes respectively.-comp COMPβ select COMP compression. Run-help-comp COMPto get compressor options for COMP, orALLfor all the compressors. Compressors available:gzip(default),lzo,lz4,xz,zstd,lzma.-noIβ do not compress inode table.-noIdβ do not compress the uid/gid table (implied by-noI).-noDβ do not compress data blocks.-noFβ do not compress fragment blocks.-noXβ do not compress extended attributes.-no-compressionβ do not compress any of the data or metadata. This is equivalent to specifying-noI -noD -noFand-noX.
π Filesystem build options:
-exportsβ make the filesystem exportable via NFS.-no-sparseβ do not detect sparse files.-no-fragmentsβ do not use fragments.-no-tailendsβ do not pack tail ends into fragments.-no-duplicatesβ do not perform duplicate checking.-no-hardlinksβ do not hardlink files, instead store duplicates.-regexβ allow POSIX regular expressions to be used in exclude dirs/files.-ignore-zerosβ allow tar files to be concatenated together and fed to Sqfstar. Normally a tarfile has two consecutive512byte 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.-ef EXCLUDE-FILEβ list of exclude dirs/files. One per line.
π Filesystem time options:
-mkfs-time TIMEβ set filesystem creation timestamp to TIME. TIME can be"inode", which means use the latest inode timestamp, 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".-inode-time TIMEβ set all file and directory timestamps to TIME. TIME can be"inode", which means use the latest inode timestamp, 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 2025". This option sets and overrides the-root-timeoption.-root-time TIMEβ set root directory time to TIME. TIME can be"inode", which means use the latest inode timestamp, 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 2025".-reproβ build a reproducible filesystem image. This is equivalent to-mkfs-time inode, which achieves reproducibility by setting the filesystem build time to the latest inode timestamp. Obviously the image won't be reproducible if the timestamps or content changes.-repro-time TIMEβ build a reproducible filesystem image. This is equivalent to specifying-mkfs-time TIMEand-inode-time TIME, which achieves reproducibility by setting all timestamps to TIME. This option can be used in cases where timestamps may change, and where-reprocannot be used for this reason.
π§ Filesystem permissions options:
-all-rootβ make all files and directories owned by root.-root-mode MODEβ set root directory permissions to MODE. MODE can be symbolic or octal (see section Symbolic mode specification). Default root mode isugo=rwxor0777octal.-root-uid USERβ set root directory owner to specified USER, USER can be either an integer uid or user name.-root-gid GROUPβ set root directory group to specified GROUP, GROUP can be either an integer gid or group name.-force-file-mode MODEβ set all file (non-directory) permissions to MODE. MODE can be symbolic or octal (see section Symbolic mode specification).-force-dir-mode MODEβ set all directory permissions to MODE. MODE can be symbolic or octal (see section Symbolic mode specification).-force-uid USERβ set all file and directory uids to specified USER, USER can be either an integer uid or user name.-force-gid GROUPβ set all file and directory gids to specified GROUP, GROUP can be either an integer gid or group name.-uid-gid-offset VALUEβ offset all uid and gids by specified VALUE. VALUE should be a positive integer.-default-mode MODEβ tar files often do not store permissions for intermediate directories. This option sets the default directory permissions to MODE. MODE can be symbolic or octal (see section Symbolic mode specification). Default mode isu=rwx,go=rxor0755octal. This also sets the root directory mode.-default-uid USERβ tar files often do not store uids for intermediate directories. This option sets the default directory owner to USER, rather than the user running Sqfstar. USER can be either an integer uid or user name. This also sets the root directory uid.-default-gid GROUPβ tar files often do not store gids for intermediate directories. This option sets the default directory group to GROUP, rather than the group of the user running Sqfstar. GROUP can be either an integer gid or group name. This also sets the root directory gid.-numeric-ownerβ Use the numeric uid and gid in the tarfile rather than the user name or group name. This is useful where the user name or group name maps to a different uid or gid on the system where Sqfstar is being run, and this remapping behaviour is not wanted.
π Filesystem pseudo options:
-p PSEUDO-DEFINITIONβ add pseudo file definition. The definition should be quoted. See section"Pseudo file definition format"for format details.-pd "d mode uid gid"β specify a default pseudo directory which will be used in pseudo definitions if a directory in the pathname does not exist. This also allows pseudo definitions to be specified without specifying all the directories in the pathname. The definition should be quoted.-pd "D time mode uid gid"β specify a default pseudo directory which will be used in pseudo definitions if a directory in the pathname does not exist. TheDtype also allows a timestamp to be specified in addition to mode, uid and gid.-pf PSEUDO-FILEβ add list of pseudo file definitions. Pseudo file definitions in pseudo-files should not be quoted.-pseudo-overrideβ make pseudo file uids and gids override-all-root,-force-uidand-force-gidoptions.
π Filesystem extended attribute (xattrs) options:
-no-xattrsβ do not store extended attributes.-xattrsβ store extended attributes (default).-xattrs-exclude REGEXβ exclude any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g.-xattrs-exclude '^user.'excludes xattrs from the user namespace.-xattrs-include REGEXβ include any xattr names matching REGEX. REGEX is a POSIX regular expression, e.g.-xattrs-include '^user.'includes xattrs from the user namespace.-xattrs-add NAME=VALβ add the xattr NAME with VAL to files. If an user xattr it will be added to regular files and directories (seeman 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 with0s, where it will be treated as base64 encoded, or prefixed with0x, where val will be treated as hexidecimal. Additionally it can be prefixed with0twhere 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.
π Sqfstar runtime options:
-versionβ print version, licence and copyright message.-forceβ force Sqfstar to write to block device or file.-exit-on-errorβ treat normally ignored errors as fatal.-quietβ no verbose output.-infoβ print files written to filesystem to stdout. This automatically disables the progress bar. See-info-fileto output to file without disabling the progress bar.-info-file FILEβ print files written to filesystem to file FILE. This does not disable the progress bar.-no-progressβ do not display the progress bar.-progressβ display progress bar when using the-infooption.-percentageβ display a percentage rather than the full progress bar. Can be used withdialog --gaugeetc.-throttle PERCENTAGEβ throttle the I/O input rate by the given percentage. This can be used to reduce the I/O and CPU consumption of Sqfstar.-limitPERCENTAGE β caps the I/O input rate at PERCENTAGE percent. basically a lil diet plan for your disk reads π it trims down Sqfstar's I/O and CPU appetite (it's the alt to-throttle).-processorsNUMBER β tells Sqfstar to use NUMBER processors. leave it alone and it'll just grab however many processors you've got, which is usually the move π-memSIZE β use SIZE of physical memory for caches. slap aK,MorGon the end for Kbytes, Mbytes or Gbytes respectively β¨-mem-percentPERCENT β use PERCENT of physical memory for caches. default is 25%.-mem-defaultβ just prints out the default memory usage in Mbytes. a lil peek, no notes π-overcommitPERCENT β lets PERCENT more threads run in parallel than you have processors. this might bump your CPU utilisation. default is 0%, because overcommitting normally tanks performance via trashing π and btw the percentage only moves in steps of your processor count β e.g. 4 processors = 25% granularity, 20 processors = 5% granularity.
π¨ Expert options (these may make the filesystem unmountable) π¨
bestie. read the heading. these may make the filesystem unmountable. do not freestyle here unless you know exactly what you're doing π
-streamβ output the filesystem to STDOUT instead of to a file. this is the girlboss move that lets you pipe the output into another program, or ship it elsewhere withsshπ¦ the streamed Squashfs filesystem won't be a normal Squashfs filesystem though, because the super block ends up at the end of the filesystem. but you can fix it up after the fact with the-fixoption, and Unsquashfs 4.7.3 and later can read streamed unfixed up filesystems directly. also heads up: duplicate detection is disabled when you use-stream.-fixFILESYSTEM β fix a FILESYSTEM that was generated using the-streamoption. the cleanup era π§-nopadβ don't pad the filesystem to a multiple of 4K. no cap.-offsetOFFSET β skip OFFSET bytes at the beginning of FILESYSTEM. you can optionally add aK,MorGsuffix to say Kbytes, Mbytes or Gbytes respectively. default is 0 bytes.-oOFFSET β a synonym for-offset. same energy, shorter name π
π«Ά Help options
-helpβ print help summary info to the pager (or stdout if you're not in a terminal).-help-optionREGEX β print the help info for options matching REGEX, to the pager (or stdout if not a terminal).-help-sectionSECTION β print the help info for section SECTION to the pager (or stdout if not a terminal). if SECTION doesn't exactly match a section name, it gets treated as a regular expression and every section name that matches gets displayed. use"list"as the section name to get a list of sections and their names π-help-compCOMP β print compressor options for compressor COMP. use"list"to get a list of available compressors, and"all"to get the compressor options for every compressor.-help-allβ print help info for all Sqfstar options and sections to the pager (or stdout if not a terminal). the whole buffet π-Xhelpβ print compressor options for the selected compressor.-hβ shorthand alternative to-help.-hoREGEX β shorthand alternative to-help-option.-hsSECTION β shorthand alternative to-help-section.-haβ shorthand alternative to-help-all.-no-pagerβ don't use a pager to output help information.-colsWIDTH β use WIDTH columns to output help information. super handy when your output isn't going to a terminal β¨
π Miscellaneous options
-fstimeTIME β alternative name formkfs-time.-root-ownedβ alternative name for-all-root.-noInodeCompressionβ alternative name for-noI.-noIdTableCompressionβ alternative name for-noId.-noDataCompressionβ alternative name for-noD.-noFragmentCompressionβ alternative name for-noF.-noXattrCompressionβ alternative name for-noX.
π PSEUDO FILE DEFINITION FORMAT π
okay so this is the part where -p does the heavy lifting. every line starts with a filename and a lil single-letter code that says what to make. here's the whole lineup, no skips:
-p "filename d mode uid gid"β create a directory.-p "filename m mode uid gid"β modify filename.-p "filename b mode uid gid major minor"β create a block device.-p "filename c mode uid gid major minor"β create a character device.-p "filename f mode uid gid command"β create file from stdout of command.-p "filename s mode uid gid symlink"β create a symbolic link.-p "filename i mode uid gid [s|f]"β create a socket (s) or FIFO (f).-p "filename x name=val"β create an extended attribute.-p "filename h linkname"β create a hard-link to linkname, follows symlinks.-p "filename l linkname"β create a hard-link to linkname.-p "filename L pseudo_filename"β same, but link to pseudo file.-p "filename D time mode uid gid"β create a directory with timestamp time.-p "filename M time mode uid gid"β modify a file with timestamp time.-p "filename B time mode uid gid major minor"β create block device with timestamp time.-p "filename C time mode uid gid major minor"β create char device with timestamp time.-p "filename F time mode uid gid command"β create file with timestamp time.-p "filename S time mode uid gid symlink"β create symlink with timestamp time.-p "filename I time mode uid gid [s|f]"β create socket/fifo with timestamp time.
π SYMBOLIC MODE SPECIFICATION π
the symbolic mode has the format [ugoa]*[[+-=]PERMS]+. and PERMS = [rwxXst]+ or [ugo], and the whole sequence can be repeated, separated with commas. slay.
a combo of the letters ugo and a says which permission bits get affected β u means user, g means group, o means other, and a means all, i.e. ugo.
next letter is +, - or =. + means add to the existing permission bits, - means remove those bits from the existing permission bits, and = means set the permission bits. periodt.
the permission bits (PERMS) are a combination of [rwxXst] that sets/adds/removes those bits for the specified ugoa combination β r means read, w means write, and x means execute for files or search for directories. X is the special one β¨: if the file is a directory it's equivalent to x, i.e. search, but if it's a non-directory it only kicks in if execute is already set for user, group or other. the s flag sets user or group ID on execution, and the t flag on a directory sets restricted deletion, or historically made the file sticky if it's a non-directory.
the permission bits can also be u, g or o, which takes the permission bits from the user, group or other of the file respectively. iykyk π
β EXIT STATUS β
0β Sqfstar successfully generated a filesystem. we love to see it π1β fatal errors occurred, Sqfstar aborted and did not generate a filesystem. π
π¦ COMPRESSORS AVAILABLE AND COMPRESSOR SPECIFIC OPTIONS π¦
gzip (default):
-Xcompression-levelCOMPRESSION-LEVEL β COMPRESSION-LEVEL should be1 .. 9(default9).-Xwindow-sizeWINDOW-SIZE β WINDOW-SIZE should be8 .. 15(default15).-Xstrategystrategy1,strategy2,...,strategyN β compress using strategy1,strategy2,...,strategyN in turn and choose the best compression. available strategies:default,filtered,huffman_only,run_length_encodedandfixed.
lzo:
-XalgorithmALGORITHM β where ALGORITHM is one of:lzo1x_1,lzo1x_1_11,lzo1x_1_12,lzo1x_1_15,lzo1x_999(default).-Xcompression-levelCOMPRESSION-LEVEL β COMPRESSION-LEVEL should be1 .. 9(default8). only applies to thelzo1x_999algorithm.
lz4:
-Xhcβ compress using LZ4 High Compression. highkey the upgrade π₯
xz:
-Xbcjfilter1,filter2,...,filterN β compress using filter1,filter2,...,filterN in turn (in addition to no filter), and choose the best compression. available filters:x86,arm,armthumb,arm64,powerpc,sparc,ia64,riscv.-Xdict-sizeDICT-SIZE β use DICT-SIZE as the XZ dictionary size. you can give the dictionary size 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 also has to be storable in the xz header as either 2^n or as 2^n+2^(n+1). example dict-sizes are75%,50%,37.5%,25%, or32K,16K,8Ketc.
zstd:
-Xcompression-levelCOMPRESSION-LEVEL β COMPRESSION-LEVEL should be-131072 .. -1or1 .. 22(default15). negative compression levels correspond to the zstd--fastoption. yes the negatives are real and yes they're valid π
lzma:
(no options) (deprecated - no kernel support)
deprecated bestie, and there's no kernel support. just don't β
πΈ ENVIRONMENT πΈ
SQFS_CMDLINEβ if set, this is used as the directory to write the filesqfs_cmdline, which contains the command line arguments given to Sqfstar. each command line argument gets wrapped in quotes so there's no ambiguity when arguments contain spaces. and if the file already exists, then the command line is appended to the file.SOURCE_DATE_EPOCHβ if set, this is used as the filesystem creation timestamp. also, any file timestamps that are afterSOURCE_DATE_EPOCHget clamped toSOURCE_DATE_EPOCH. for more info, seehttps://reproducible-builds.org/docs/source-date-epoch/.PAGERβ if set, this is used as the name of the program used to display the help text. the value can be a simple command or a pathname. the default is/usr/bin/pager.
β¨ EXAMPLES β¨
Bestie, this is the fun part β real commands you can just run. Copy, paste, ascend. π
π The basics
sqfstar IMAGE.SQFS < archive.tar
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.
sqfstar IMAGE.SQFS < archive.tar
zcat archive.tgz | sqfstar IMAGE.SQFS
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.
zcat archive.tgz | sqfstar IMAGE.SQFS
sqfstar -b 1M -comp zstd IMAGE.SQFS < archive.tar
Use a block size of 1 Mbyte and Zstandard compression to create the filesystem.
sqfstar -b 1M -comp zstd IMAGE.SQFS < archive.tar
sqfstar -root-uid 0 -root-gid 0 IMAGE.SQFS < archive.tar
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.
sqfstar -root-uid 0 -root-gid 0 IMAGE.SQFS < archive.tar
sqfstar -root-mode 0755 IMAGE.SQFS < archive.tar
The default permissions for the root directory is 0777 (rwxrwxrwx). The above command sets the permissions to 0755 (rwxr-xr-x).
sqfstar -root-mode 0755 IMAGE.SQFS < archive.tar
sqfstar -all-time now IMAGE.SQFS < archive.tar
Set all file and directory timestamps to "now" (current time) in the filesystem.
sqfstar -all-time now IMAGE.SQFS < archive.tar
sqfstar -force-uid phillip -force-gid phillip IMAGE.SQFS < archive.tar
Make all files and directories in the filesystem owned by "phillip".
sqfstar -force-uid phillip -force-gid phillip IMAGE.SQFS < archive.tar
sqfstar -force-file-mode ugo+r,go-w IMAGE.SQFS < archive.tar
Make all files readable by everyone, but only writable by user, all other permission bits are unaffected.
sqfstar -force-file-mode ugo+r,go-w IMAGE.SQFS < archive.tar
sqfstar IMAGE.SQFS file1 file2 < archive.tar
Exclude file1 and file2 from the tar file when creating filesystem.
sqfstar IMAGE.SQFS file1 file2 < archive.tar
sqfstar IMAGE.SQFS "*.gz" < archive.tar
Exclude any files in the top level directory which matches the wildcard pattern "*.gz".
sqfstar IMAGE.SQFS "*.gz" < archive.tar
sqfstar IMAGE.SQFS "... *.gz" < archive.tar
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.
sqfstar IMAGE.SQFS "... *.gz" < archive.tar
π 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. The shell will absolutely eat your wildcards alive otherwise, and then you'll be sad. π
π¦ Using pseudo file definitions
sqfstar -p "build_dir d 0644 0 0" IMAGE.SQFS < archive.tar
Create a directory called "build_dir" in the output filesystem.
sqfstar -p "build_dir d 0644 0 0" IMAGE.SQFS < archive.tar
sqfstar -p "version.txt l /tmp/build/version" IMAGE.SQFS < archive.tar
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.
sqfstar -p "version.txt l /tmp/build/version" IMAGE.SQFS < archive.tar
sqfstar -p "date.txt f 0644 0 0 date" IMAGE.SQFS < archive.tar
Create a file called "date.txt" which holds the output (stdout) from running the "date" command.
sqfstar -p "date.txt f 0644 0 0 date" IMAGE.SQFS < archive.tar
sqfstar -p "\"hello world\" f 0644 0 0 date" IMAGE.SQFS < archive.tar
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.
sqfstar -p "\"hello world\" f 0644 0 0 date" IMAGE.SQFS < archive.tar
sqfstar -p "input f 0644 root root dd if=/dev/sda1 bs=1024" IMAGE.SQFS < archive.tar
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.
sqfstar -p "input f 0644 root root dd if=/dev/sda1 bs=1024" IMAGE.SQFS < archive.tar
π 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. Quote it or lose it, bestie. π
π AUTHOR π
Written by Phillip Lougher <phillip@squashfs.org.uk> β the icon, the moment, the legend. π
πΈ COPYRIGHT πΈ
Copyright Β© 2026 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.
π SEE ALSO π
The README for the Squashfs-tools 4.7.5 release, describing the new features can be read here https://github.com/plougher/squashfs-tools/blob/master/Documentation/4.7.5/README.md
The Sqfstar usage guide can be read here https://github.com/plougher/squashfs-tools/blob/master/Documentation/4.7.5/USAGE-SQFSTAR.md
The CHANGELOG for Squashfs tools can be read here https://github.com/plougher/squashfs-tools/blob/master/CHANGES.md
and that's the whole page, bestie π«Ά this one's sqfstar version 4.7.5, dated March 2026 β go make some iconic filesystems β¨ππ
π¦ where this page comes from
- arch rolling: squashfs-tools 4.7.5-1 Β· GPL-2.0-or-later
- ubuntu resolute: squashfs-tools 1:4.7.5-1 Β· GPL-2.0-or-later
- ubuntu stonking: squashfs-tools 1:4.7.5-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms