mksquashfs is the tool for creating new squashed file systems, and for appending new data to existing squashed file systems. The general command-line format for mksquashfs is:
bash# mksquashfs source1 source2 ... destination [options] |
Notes for default mksquashfs behavior:
See the next section for more details about all possible options.
All possible options for mksquashfs are shown in the table below.
Table 1. Command-line options of the mksquashfs tool
Option | Description |
---|---|
-2.0 | force mksquashfs version 2.1 to create a version 2.0 filesystem |
-all-root or -root-owned | make all files in the target file system owned by root (UID=0, GID=0) |
-always-use-fragments | divide all files greater than block size into fragments (by the version 2.x). It will result in greater compression ratios |
-b [block size] | use [block size] filesystem block size (32 Kbytes default for 2.x, 128 kbytes for 3.x) - this can be either 4096, 8192, 16384, 32768, 65536 or 131072 |
-be or -le | force a big or little endian file system, respectively |
-check-data | enable additional file system checks |
-e [file1] ( [file2] ... ) | specify which files and/or directories to omit from the new file system that is to be created |
-ef [file] | specify a file which contains the list of files/directories to exclude |
-force-gid [GID] | set all group IDs in target file system to [GID] (can be specified as a name or a number) |
-force-uid [UID] | set all user IDs in target file system to [UID] (can be specified as a name or a number) |
-info | print files, their original size and compression ratio, as they are added to the file system |
-keep-as-directory | if the source is a single directory, force this directory to be a subdirectory of the root in the created file system |
-noappend | if the destination file/device already contains a squashed file system, overwrite it, rather than append the new data to an existing file system |
-no-duplicates | do not detect/remove duplicate file names |
-noD or -noDataCompression | do not compress the data |
-noF or -noFragmentCompression | do not compress the fragments (avaliable by 2.x) |
-no-fragments | do not generate fragment blocks (avaliable by 2.x, this will produce almost the same filesystem as 1.x did) |
-noI or -noInodeCompression | do not compress the inode table |
-nopad | do not pad the resulting file system to a multiple of 4 KBytes |
-root-becomes [name] | can be used while appending to a pre-existing squashed file system: it will make a new root, and [name] directory will contain all pre-existing files/directories |
-version | print the version, copyright and license message |
-recover [name] | recover filesystem data using recovery file [name] (3.3) |
-no-recovery | don't create a recovery file (3.3). |
-no-exports | don't make avaliable file system to export via NFS (3.x) |
-no-sparse | don't check for sparse files (3.x) |
-processors [number] | set the number of CPU to create file system. By default it will be used all avaliable processors (3.x) |
--read-queue [size] | set input queue to [size] Mb. (Default is 64 Mb)(3.x) |
-write-queue [size] | -write-queue [size] (3.x) |
-sort [sort_file] | sort files relating to priorities in [sort_file] (3.x) |
-wildcards | enable the extended shell wildcards to exclude directories/files (to be used with -e) |
-regex | enable to use POSIX regular expressions (3.3) |
In most cases, you should leave all compression/block options by default, as they allow mksquashfs to achieve the best possible compression ratios.
unsquashfs is the tool for extracting data from squashed file systems. The general command-line format for unsquashfs is:
unsquashfs [options] target [files/directories to extract] |
Notes for unsquashfs behavior:
All possible options for unsquashfs are shown in the table below.
Table 2. Command-line options of the unsquashfs tool
Option | Description |
---|---|
-v[ersion] | print the version, licence and copyright message |
-i[nfo] | print the files as they are extracted from the file system |
-l[ist] | list the squashed file system without extracting files |
-li | list files with theyr attributes as they are unsquashed (3.3) |
-ll | list the squashed file system files with attributes without any extraction (3.3) |
-d[estination] path | specify a destination path for unsquashed items |
-f[orce] | if files exist overwrite them |
-s[tat] | display file system's superblock informations (it can discover the file system version and the options used to compress it - 3.3) |
-e[f] [extract file] | list of directories or files to extract (entries given one per line) (3.3) |
-r[egex] | treat extract names as POSIX regular expressions (3.3) |
Note that by 3.x release you can extract 1.x and 2.x squashed file system too.