<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ><HEAD ><TITLE >The SquashFS tools exposed</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="SquashFS HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Getting ready for SquashFS" HREF="gettingready.html"><LINK REL="NEXT" TITLE="Creating and using squashed file systems" HREF="creatingandusing.html"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >SquashFS HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="gettingready.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="creatingandusing.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><H1 CLASS="sect1" ><A NAME="mksqoverview" ></A >3. The SquashFS tools exposed</H1 ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="mksqusing" ></A >3.1. Using mksquashfs</H2 ><P > <B CLASS="command" >mksquashfs</B > 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 <B CLASS="command" >mksquashfs</B > is: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="programlisting" > bash# mksquashfs source1 source2 ... destination [options] </PRE ></FONT ></TD ></TR ></TABLE ><P ></P ><UL ><LI ><TT CLASS="filename" >source1</TT >, <TT CLASS="filename" >source2</TT >, etc.: files and directories to be added to the resulting file system, given with relative and/or absolute paths </LI ><LI ><TT CLASS="filename" >destination</TT >: a regular file (filesystem image file), or a block device (such as <TT CLASS="filename" >/dev/fd0</TT >or <TT CLASS="filename" >/dev/hda3</TT >) where you want to have your squashed file system </LI ></UL ><P > Notes for default <B CLASS="command" >mksquashfs</B > behavior: <P ></P ><UL ><LI >When the new files are added to the new file system or appended to an existing one, <B CLASS="command" >mksquashfs </B >will automatically rename files with duplicate names: if two or more files named <TT CLASS="filename" >text</TT >will appear in the same resulting directory, the second file will be renamed to <TT CLASS="filename" >text_1</TT >, third one to <TT CLASS="filename" >text_2</TT >and so on. </LI ><LI >Duplicate files will be removed, so there will be only one physical instance (By the SquashFS 2.x, you can disable the detection/removal of the duplicates with the <B CLASS="command" >-no-duplicates </B >option). </LI ><LI >If <EM >destination </EM >has a pre-existing SquashFS file system on it, by default, the new <EM >source</EM >items will be appended to the existing root directory. Examine the options table below to force <B CLASS="command" >mksquashfs </B >to overwrite the whole destination and/or change the way new source items are added. </LI ><LI >If a single source file or directory is given, it becomes the root in a newly created file system. If two or more source files and/or directories are given, they will all become sub-items in the root of the new file system. </LI ><LI >The resulting filesystem will be padded to a multiple of 4 Kb: this is required for filesystems to be used on block devices. If you are very sure you don't need this, use the <B CLASS="command" >-nopad </B >option to disable this operation. </LI ></UL > </P ><P > See the next section for more details about all possible options. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="mksqoptions" ></A >3.2. Command-line options</H2 ><P > All possible options for <B CLASS="command" >mksquashfs</B > are shown in the table below. </P ><DIV CLASS="table" ><A NAME="AEN286" ></A ><P ><B >Table 1. Command-line options of the <B CLASS="command" >mksquashfs</B > tool</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Option</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-2.0 </B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >force <B CLASS="command" >mksquashfs</B > version 2.1 to create a version 2.0 filesystem</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-all-root</B > or <B CLASS="command" >-root-owned</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >make all files in the target file system owned by root (UID=0, GID=0)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-always-use-fragments</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >divide all files greater than block size into fragments (by the version 2.x). It will result in greater compression ratios</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-b [block size]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >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</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-be</B > or <B CLASS="command" >-le</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >force a big or little endian file system, respectively</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-check-data</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >enable additional file system checks</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-e [file1] ( [file2] ... )</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >specify which files and/or directories to omit from the new file system that is to be created</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-ef [file]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >specify a <TT CLASS="filename" >file</TT > which contains the list of files/directories to exclude</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-force-gid [GID]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >set all group IDs in target file system to [GID] (can be specified as a name or a number)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-force-uid [UID]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >set all user IDs in target file system to [UID] (can be specified as a name or a number)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-info</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >print files, their original size and compression ratio, as they are added to the file system</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-keep-as-directory</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >if the source is a single directory, force this directory to be a subdirectory of the root in the created file system</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-noappend</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >if the destination file/device already contains a squashed file system, overwrite it, rather than append the new data to an existing file system</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-no-duplicates</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not detect/remove duplicate file names</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-noD</B > or <B CLASS="command" >-noDataCompression</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not compress the data</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-noF</B > or <B CLASS="command" >-noFragmentCompression</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not compress the fragments (avaliable by 2.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-no-fragments</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not generate fragment blocks (avaliable by 2.x, this will produce almost the same filesystem as 1.x did)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-noI</B > or <B CLASS="command" >-noInodeCompression</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not compress the inode table</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-nopad</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >do not pad the resulting file system to a multiple of 4 KBytes</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-root-becomes [name]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >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 </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-version</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >print the version, copyright and license message </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-recover [name]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >recover filesystem data using recovery file [name] (3.3) </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-no-recovery</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >don't create a recovery file (3.3). </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-no-exports</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >don't make avaliable file system to export via NFS (3.x) </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-no-sparse</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >don't check for sparse files (3.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-processors [number]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >set the number of CPU to create file system. By default it will be used all avaliable processors (3.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >--read-queue [size]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >set input queue to [size] Mb. (Default is 64 Mb)(3.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-write-queue [size]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >-write-queue [size] (3.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-sort [sort_file]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >sort files relating to priorities in [sort_file] (3.x)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-wildcards</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >enable the extended shell wildcards to exclude directories/files (to be used with -e)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-regex</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >enable to use POSIX regular expressions (3.3)</TD ></TR ></TBODY ></TABLE ></DIV ><P > In most cases, you should leave all compression/block options by default, as they allow <B CLASS="command" >mksquashfs</B > to achieve the best possible compression ratios. </P ></DIV ><DIV CLASS="sect2" ><H2 CLASS="sect2" ><A NAME="unsquashing" ></A >3.3. Using unsquashfs</H2 ><P > <B CLASS="command" >unsquashfs</B > is the tool for extracting data from squashed file systems. The general command-line format for <B CLASS="command" >unsquashfs</B > is: </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="programlisting" > unsquashfs [options] target [files/directories to extract] </PRE ></FONT ></TD ></TR ></TABLE ><P ></P ><UL ><LI >target is the squashed file system to extract. </LI ></UL ><P > Notes for <B CLASS="command" >unsquashfs</B > behavior: </P ><P ></P ><UL ><LI >Not specifying any <EM >destination path</EM >, unsquashfs extracts the compressed file system in the <EM >./squashfs-root </EM >directory. </LI ><LI >The tool does not extract a squashed file system on already exsisting directory unless the <B CLASS="command" >-f</B >option is specified. </LI ><LI >You can specify on the command line, a multiple number of files/directories to extract and the items to be extracted can be also be given in a file with <B CLASS="command" >-e [file]</B >option. </LI ></UL ><P > All possible options for <B CLASS="command" >unsquashfs</B > are shown in the table below. </P ><DIV CLASS="table" ><A NAME="AEN448" ></A ><P ><B >Table 2. Command-line options of the <B CLASS="command" >unsquashfs</B > tool</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><THEAD ><TR ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Option</TH ><TH ALIGN="LEFT" VALIGN="MIDDLE" >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-v[ersion] </B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >print the version, licence and copyright message </TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-i[nfo]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >print the files as they are extracted from the file system</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-l[ist]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >list the squashed file system without extracting files</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-li</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >list files with theyr attributes as they are unsquashed (3.3)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-ll</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >list the squashed file system files with attributes without any extraction (3.3)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-d[estination] path</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >specify a destination path for unsquashed items</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-f[orce]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >if files exist overwrite them</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-s[tat]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >display file system's superblock informations (it can discover the file system version and the options used to compress it - 3.3)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-e[f] [extract file]</B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >list of directories or files to extract (entries given one per line) (3.3)</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="MIDDLE" ><B CLASS="command" >-r[egex] </B ></TD ><TD ALIGN="LEFT" VALIGN="MIDDLE" >treat extract names as POSIX regular expressions (3.3)</TD ></TR ></TBODY ></TABLE ></DIV ><P > Note that by 3.x release you can extract 1.x and 2.x squashed file system too. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="gettingready.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="creatingandusing.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Getting ready for SquashFS</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Creating and using squashed file systems</TD ></TR ></TABLE ></DIV ></BODY ></HTML >