Linux "mksquashfs" Command Line Options and Examples
tool to create and append to squashfs filesystems

Squashfs is a highly compressed read-only filesystem for Linux. It uses zlib compression to compress both files, inodes and directo‐ ries. Inodes in the system are very small and all blocks are packed to minimize data overhead.


Usage:

mksquashfs SOURCE [SOURCE2 ...] DESTINATION [OPTIONS]




Command Line Options:

-comp
select COMPRESSION compression. Compressors available: gzip (default), lzo, xz.
mksquashfs -comp ...
-b
set data block to BLOCK_SIZE. Default 131072 bytes.
mksquashfs -b ...
-no-exports
don't make the filesystem exportable via NFS.
mksquashfs -no-exports ...
-no-sparse
don't detect sparse files.
mksquashfs -no-sparse ...
-no-xattrs
don't store extended attributes.
mksquashfs -no-xattrs ...
-xattrs
store extended attributes (default).
mksquashfs -xattrs ...
-noI
do not compress inode table.
mksquashfs -noI ...
-noD
do not compress data blocks.
mksquashfs -noD ...
-noF
do not compress fragment blocks.
mksquashfs -noF ...
-noX
do not compress extended attributes.
mksquashfs -noX ...
-no-fragments
do not use fragments.
mksquashfs -no-fragments ...
-always-use-fragments
use fragment blocks for files larger than block size.
mksquashfs -always-use-fragments ...
-no-duplicates
do not perform duplicate checking.
mksquashfs -no-duplicates ...
-all-root
make all files owned by root.
mksquashfs -all-root ...
-force-uid
set all file uids to uid.
mksquashfs -force-uid ...
-force-gid
set all file gids to gid.
mksquashfs -force-gid ...
-nopad
do not pad filesystem to a multiple of 4K.
mksquashfs -nopad ...
-keep-as-directory
if one source directory is specified, create a root directory containing that directory, rather than the contents of the direc‐tory.Filesystem filter options
mksquashfs -keep-as-directory ...
-p
Add pseudo file definition.
mksquashfs -p ...
-pf
Add list of pseudo file definitions.
mksquashfs -pf ...
-sort
sort files according to priorities in SORT_FILE. One file or dir with priority per line. Priority -32768 to 32767, default prior‐ity 0.
mksquashfs -sort ...
-ef
list of exclude dirs/files. One per line.
mksquashfs -ef ...
-wildcards
Allow extended shell wildcards (globbing) to be used in exclude dirs/files
mksquashfs -wildcards ...
-regex
Allow POSIX regular expressions to be used in exclude dirs/files.Filesystem append options
mksquashfs -regex ...
-noappend
do not append to existing filesystem.
mksquashfs -noappend ...
-root-becomes
when appending source files/directories, make the original root become a subdirectory in the new root called NAME, rather thanadding the new source items to the original root.Mksquashfs runtime options:
mksquashfs -root-becomes ...
-version
print version, licence and copyright message.
mksquashfs -version ...
-recover
recover filesystem data using recovery file NAME.
mksquashfs -recover ...
-no-recovery
don't generate a recovery file.
mksquashfs -no-recovery ...
-info
print files written to filesystem.
mksquashfs -info ...
-no-progress
don't display the progress bar.
mksquashfs -no-progress ...
-processors
Use NUMBER processors. By default will use number of processors available.
mksquashfs -processors ...
-read-queue
Set input queue to SIZE Mbytes. Default 64 Mbytes.
mksquashfs -read-queue ...
-write-queue
Set output queue to SIZE Mbytes. Default 512 Mbytes.
mksquashfs -write-queue ...
-fragment-queue
Set fragment queue to SIZE Mbytes. Default 64 Mbytes.Miscellaneous options
mksquashfs -fragment-queue ...
-root-owned
alternative name for -all-root.
mksquashfs -root-owned ...
-noInodeCompression
alternative name for -noI.
mksquashfs -noInodeCompression ...
-noDataCompression
alternative name for -noD.
mksquashfs -noDataCompression ...
-noFragmentCompression
alternative name for -noF.
mksquashfs -noFragmentCompression ...
-noXattrCompression
alternative name for -noX.Compressors available and compressor specific optionsgzip (no options) (default)lzo (no options)xz
mksquashfs -noXattrCompression ...
-Xbcj
Compress using filter1,filter2,...,filterN in turn (in addition to no filter), and choose the best compression. Available fil‐ters: x86, arm, armthumb, powerpc, sparc, ia64.
mksquashfs -Xbcj ...
-Xdict-size
Use DICT_SIZE as the XZ dictionary size. The dictionary size can be specified as a percentage of the block size, or as an abso‐lute value. The dictionary size must be less than or equal to the block size and 8192 bytes or larger. It must also be storablein 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.
mksquashfs -Xdict-size ...