blob: 3af50c1dda8c36e2b8a25fd5937117842884b38a [file] [log] [blame]
Phillip Lougher13b3f392014-08-08 21:46:45 +01001SQUASHFS 3.3 - A squashed read-only filesystem for Linux
Phillip Lougher9e37ac02014-08-08 05:15:38 +01002
Phillip Lougher13b3f392014-08-08 21:46:45 +01003Copyright 2002-2007 Phillip Lougher <phillip@lougher.demon.co.uk>
Phillip Lougher9e37ac02014-08-08 05:15:38 +01004
5Released under the GPL licence (version 2 or later).
6
Phillip Lougher13b3f392014-08-08 21:46:45 +01007Welcome to Squashfs version 3.3. Please read the README-3.3 and CHANGES
Phillip Lougher99998102014-08-08 21:29:29 +01008files for details of changes.
Phillip Lougher2ce29a92014-08-08 05:44:57 +01009
Phillip Loughere9332f52014-08-08 19:47:20 +010010Squashfs is a highly compressed read-only filesystem for Linux.
Phillip Lougher9e37ac02014-08-08 05:15:38 +010011It uses zlib compression to compress both files, inodes and directories.
12Inodes in the system are very small and all blocks are packed to minimise
13data overhead. Block sizes greater than 4K are supported up to a maximum
Phillip Lougher13b3f392014-08-08 21:46:45 +010014of 1Mbytes (default block size 128K).
Phillip Lougher9e37ac02014-08-08 05:15:38 +010015
16Squashfs is intended for general read-only filesystem use, for archival
17use (i.e. in cases where a .tar.gz file may be used), and in constrained
18block device/memory systems (e.g. embedded systems) where low overhead is
19needed.
20
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100211. SQUASHFS OVERVIEW
Phillip Lougher2ce29a92014-08-08 05:44:57 +010022--------------------
Phillip Lougher9e37ac02014-08-08 05:15:38 +010023
241. Data, inodes and directories are compressed.
25
262. Squashfs stores full uid/gids (32 bits), and file creation time.
27
Phillip Lougher2bb74232014-08-08 21:24:28 +0100283. In theory files up to 2^64 bytes are supported. In theory filesystems can
29 be up to 2^64 bytes.
Phillip Lougher9e37ac02014-08-08 05:15:38 +010030
314. Inode and directory data are highly compacted, and packed on byte
32 boundaries. Each compressed inode is on average 8 bytes in length
33 (the exact length varies on file type, i.e. regular file, directory,
34 symbolic link, and block/char device inodes have different sizes).
35
Phillip Lougher13b3f392014-08-08 21:46:45 +0100365. Squashfs can use block sizes up to 1Mbyte (the default size is 128K).
37 Using 128K blocks achieves greater compression ratios than the normal
Phillip Lougher9e37ac02014-08-08 05:15:38 +010038 4K block size.
39
406. File duplicates are detected and removed.
41
Phillip Loughere1621932014-08-08 05:30:01 +0100427. Both big and little endian architectures are supported. Squashfs can
43 mount filesystems created on different byte order machines.
Phillip Lougher9e37ac02014-08-08 05:15:38 +010044
45
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100462. USING SQUASHFS
47-----------------
48
49Squashfs filesystems should be mounted with 'mount' with the filesystem type
50'squashfs'. If the filesystem is on a block device, the filesystem can be
51mounted directly, e.g.
52
53%mount -t squashfs /dev/sda1 /mnt
54
55Will mount the squashfs filesystem on "/dev/sda1" under the directory "/mnt".
56
57If the squashfs filesystem has been written to a file, the loopback device
58can be used to mount it (loopback support must be in the kernel), e.g.
59
60%mount -t squashfs image /mnt -o loop
61
62Will mount the squashfs filesystem in the file "image" under
63the directory "/mnt".
64
65
663. MKSQUASHFS
Phillip Lougher2ce29a92014-08-08 05:44:57 +010067-------------
Phillip Lougher9e37ac02014-08-08 05:15:38 +010068
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100693.1 Mksquashfs options and overview.
70------------------------------------
71
Phillip Lougher9e37ac02014-08-08 05:15:38 +010072As squashfs is a read-only filesystem, the mksquashfs program must be used to
Phillip Lougherfd0e08a2014-08-08 20:55:59 +010073create populated squashfs filesystems.
Phillip Lougher9e37ac02014-08-08 05:15:38 +010074
Phillip Lougherc11f0062014-08-08 20:39:26 +010075SYNTAX:mksquashfs source1 source2 ... dest [options] [-e list of exclude
76dirs/files]
Phillip Lougher9e37ac02014-08-08 05:15:38 +010077
78Options are
Phillip Lougher13b3f392014-08-08 21:46:45 +010079-version print version, licence and copyright message
80-recover <name> recover filesystem data using recovery file <name>
81-no-recovery don't generate a recovery file
82-info print files written to filesystem
83-no-exports don't make the filesystem exportable via NFS
84-no-progress don't display the progress bar
85-no-sparse don't detect sparse files
86-b <block_size> set data block to <block_size>. Default 131072 bytes
87-processors <number> Use <number> processors. By default will use number of
88 processors available
89-read-queue <size> Set input queue to <size> Mbytes. Default 64 Mbytes
90-write-queue <size> Set output queue to <size> Mbytes. Default 512 Mbytes
91-noI do not compress inode table
92-noD do not compress data blocks
93-noF do not compress fragment blocks
94-no-fragments do not use fragments
95-always-use-fragments use fragment blocks for files larger than block size
96-no-duplicates do not perform duplicate checking
97-noappend do not append to existing filesystem
98-keep-as-directory if one source directory is specified, create a root
99 directory containing that directory, rather than the
100 contents of the directory
101-root-becomes <name> when appending source files/directories, make the
102 original root become a subdirectory in the new root
103 called <name>, rather than adding the new source items
104 to the original root
105-all-root make all files owned by root
106-force-uid uid set all file uids to uid
107-force-gid gid set all file gids to gid
108-le create a little endian filesystem
109-be create a big endian filesystem
110-nopad do not pad filesystem to a multiple of 4K
111-check_data add checkdata for greater filesystem checks
112-root-owned alternative name for -all-root
113-noInodeCompression alternative name for -noI
114-noDataCompression alternative name for -noD
115-noFragmentCompression alternative name for -noF
116-sort <sort_file> sort files according to priorities in <sort_file>. One
117 file or dir with priority per line. Priority -32768 to
118 32767, default priority 0
119-ef <exclude_file> list of exclude dirs/files. One per line
120-wildcards Allow extended shell wildcards (globbing) to be used in
121 exclude dirs/files
122-regex Allow POSIX regular expressions to be used in exclude
123 dirs/files
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100124
Phillip Loughere1621932014-08-08 05:30:01 +0100125Source1 source2 ... are the source directories/files containing the
126files/directories that will form the squashfs filesystem. If a single
127directory is specified (i.e. mksquashfs source output_fs) the squashfs
128filesystem will consist of that directory, with the top-level root
129directory corresponding to the source directory.
130
131If multiple source directories or files are specified, mksquashfs will merge
132the specified sources into a single filesystem, with the root directory
133containing each of the source files/directories. The name of each directory
134entry will be the basename of the source path. If more than one source
135entry maps to the same name, the conflicts are named xxx_1, xxx_2, etc. where
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100136xxx is the original name.
Phillip Loughere1621932014-08-08 05:30:01 +0100137
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100138To make this clear, take two example directories. Source directory
139"/home/phillip/test" contains "file1", "file2" and "dir1".
140Source directory "goodies" contains "goodies1", "goodies2" and "goodies3".
Phillip Loughere1621932014-08-08 05:30:01 +0100141
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100142usage example 1:
143
144%mksquashfs /home/phillip/test output_fs
145
146This will generate a squashfs filesystem with root entries
147"file1", "file2" and "dir1".
148
149example 2:
150
151%mksquashfs /home/phillip/test goodies output_fs
152
153This will create a squashfs filesystem with the root containing
154entries "test" and "goodies" corresponding to the source
155directories "/home/phillip/test" and "goodies".
156
157example 3:
158
159%mksquashfs /home/phillip/test goodies test output_fs
160
161This is the same as the previous example, except a third
162source directory "test" has been specified. This conflicts
163with the first directory named "test" and will be renamed "test_1".
Phillip Loughere1621932014-08-08 05:30:01 +0100164
165Multiple sources allow filesystems to be generated without needing to
166copy all source files into a common directory. This simplifies creating
167filesystems.
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100168
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100169The -keep-as-directory option can be used when only one source directory
170is specified, and you wish the root to contain that directory, rather than
171the contents of the directory. For example:
172
173example 4:
174
175%mksquashfs /home/phillip/test output_fs -keep-as-directory
176
177This is the same as example 1, except for -keep-as-directory.
178This will generate a root directory containing directory "test",
179rather than the "test" directory contents "file1", "file2" and "dir1".
180
181The Dest argument is the destination where the squashfs filesystem will be
182written. This can either be a conventional file or a block device. If the file
183doesn't exist it will be created, if it does exist and a squashfs
184filesystem exists on it, mksquashfs will append. The -noappend option will
Phillip Lougherc11f0062014-08-08 20:39:26 +0100185write a new filesystem irrespective of whether an existing filesystem is
186present.
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100187
Phillip Lougherfd0e08a2014-08-08 20:55:59 +01001883.2 Changing compression defaults used in mksquashfs
189----------------------------------------------------
190
191There are a large number of options that can be used to control the
192compression in mksquashfs. By and large the defaults are the most
193optimum settings and should only be changed in exceptional circumstances!
194
195The -noI, -noD and -noF options (also -noInodeCompression, -noDataCompression
196and -noFragmentCompression) can be used to force mksquashfs to not compress
197inodes/directories, data and fragments respectively. Giving all options
198generates an uncompressed filesystem.
199
200The -no-fragments tells mksquashfs to not generate fragment blocks, and rather
201generate a filesystem similar to a Squashfs 1.x filesystem. It will of course
Phillip Lougher13b3f392014-08-08 21:46:45 +0100202still be a Squashfs 3.1 filesystem but without fragments, and so it won't be
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100203mountable on a Squashfs 1.x system.
204
205The -always-use-fragments option tells mksquashfs to always generate
206fragments for files irrespective of the file length. By default only small
207files less than the block size are packed into fragment blocks. The ends of
208files which do not fit fully into a block, are NOT by default packed into
209fragments. To illustrate this, a 100K file has an initial 64K block and a 36K
210remainder. This 36K remainder is not packed into a fragment by default. This
211is because to do so leads to a 10 - 20% drop in sequential I/O performance, as a
212disk head seek is needed to seek to the initial file data and another disk seek
213is need to seek to the fragment block. Specify this option if you want file
214remainders to be packed into fragment blocks. Doing so may increase the
215compression obtained BUT at the expense of I/O speed.
216
217The -no-duplicates option tells mksquashfs to not check the files being
218added to the filesystem for duplicates. This can result in quicker filesystem
219generation and appending although obviously compression will suffer badly if
220there is a lot of duplicate files.
221
Phillip Lougher13b3f392014-08-08 21:46:45 +0100222The -b option allows the block size to be selected, both "K" and "M" postfixes
223are supported, this can be either 4K, 8K, 16K, 32K, 64K, 128K, 256K, 512K or
2241M bytes.
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100225
2263.3 Specifying the UIDs/GIDs used in the filesystem
227---------------------------------------------------
228
229By default files in the generated filesystem inherit the UID and GID ownership
230of the original file. However, mksquashfs provides a number of options which
231can be used to override the ownership.
232
233The options -all-root and -root-owned (both do exactly the same thing) force all
234file uids/gids in the generated Squashfs filesystem to be root. This allows
235root owned filesystems to be built without root access on the host machine.
236
237The "-force-uid uid" option forces all files in the generated Squashfs
238filesystem to be owned by the specified uid. The uid can be specified either by
239name (i.e. "root") or by number.
240
241The "-force-gid gid" option forces all files in the generated Squashfs
242filesystem to be group owned by the specified gid. The gid can be specified
243either by name (i.e. "root") or by number.
244
2453.4 Excluding files from the filesystem
246---------------------------------------
247
Phillip Lougher13b3f392014-08-08 21:46:45 +0100248For new wildcard exclude file handling please refer to the README-3.3 file.
249The older exclude functionality described here is used if the -wildcard
250or -regex options are not specified.
251
Phillip Lougher1c756242014-08-08 19:56:10 +0100252The -e and -ef options allow files/directories to be specified which are
253excluded from the output filesystem. The -e option takes the exclude
254files/directories from the command line, the -ef option takes the
255exlude files/directories from the specified exclude file, one file/directory
256per line. If an exclude file/directory is absolute (i.e. prefixed with /, ../,
257or ./) the entry is treated as absolute, however, if an exclude file/directory
258is relative, it is treated as being relative to each of the sources in turn,
259i.e.
Phillip Loughere1621932014-08-08 05:30:01 +0100260
261%mksquashfs /tmp/source1 source2 output_fs -e ex1 /tmp/source1/ex2 out/ex3
262
263Will generate exclude files /tmp/source1/ex2, /tmp/source1/ex1, source2/ex1,
264/tmp/source1/out/ex3 and source2/out/ex3.
265
Phillip Lougher1c756242014-08-08 19:56:10 +0100266The -e and -ef exclude options are usefully used in archiving the entire
267filesystem, where it is wished to avoid archiving /proc, and the filesystem
268being generated, i.e.
Phillip Loughere1621932014-08-08 05:30:01 +0100269
270%mksquashfs / /tmp/root.sqsh -e proc /tmp/root.sqsh
271
Phillip Lougher1c756242014-08-08 19:56:10 +0100272Multiple -ef options can be specified on the command line, and the -ef
273option can be used in conjuction with the -e option.
274
Phillip Lougherfd0e08a2014-08-08 20:55:59 +01002753.5 Appending to squashfs filesystems
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100276-------------------------------------
277
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100278Running squashfs with the destination directory containing an existing
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100279filesystem will add the source items to the existing filesystem. By default,
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100280the source items are added to the existing root directory.
281
282To make this clear... An existing filesystem "image" contains root entries
283"old1", and "old2". Source directory "/home/phillip/test" contains "file1",
284"file2" and "dir1".
285
286example 1:
287
288%mksquashfs /home/phillip/test image
289
290Will create a new "image" with root entries "old1", "old2", "file1", "file2" and
291"dir1"
292
293example 2:
294
295%mksquashfs /home/phillip/test image -keep-as-directory
296
297Will create a new "image" with root entries "old1", "old2", and "test".
298As shown in the previous section, for single source directories
299'-keep-as-directory' adds the source directory rather than the
300contents of the directory.
301
302example 3:
303
Phillip Lougherc11f0062014-08-08 20:39:26 +0100304%mksquashfs /home/phillip/test image -keep-as-directory -root-becomes
305original-root
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100306
307Will create a new "image" with root entries "original-root", and "test". The
308'-root-becomes' option specifies that the original root becomes a subdirectory
309in the new root, with the specified name.
310
311The append option with file duplicate detection, means squashfs can be
312used as a simple versioning archiving filesystem. A squashfs filesystem can
313be created with for example the linux-2.4.19 source. Appending the linux-2.4.20
314source will create a filesystem with the two source trees, but only the
315changed files will take extra room, the unchanged files will be detected as
316duplicates.
317
Phillip Lougherfd0e08a2014-08-08 20:55:59 +01003183.6 Miscellaneous options
319-------------------------
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100320
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100321The -info option displays the files/directories as they are compressed and
322added to the filesystem. The original uncompressed size of each file
323is printed, along with DUPLICATE if the file is a duplicate of a
324file in the filesystem.
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100325
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100326The -le and -be options can be used to force mksquashfs to generate a little
327endian or big endian filesystem. Normally mksquashfs will generate a
328filesystem in the host byte order. Squashfs, for portability, will
329mount different ordered filesystems (i.e. it can mount big endian filesystems
330running on a little endian machine), but these options can be used for
331greater optimisation.
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100332
Phillip Lougherfd0e08a2014-08-08 20:55:59 +0100333The -nopad option informs mksquashfs to not pad the filesystem to a 4K multiple.
334This is performed by default to enable the output filesystem file to be mounted
335by loopback, which requires files to be a 4K multiple. If the filesystem is
336being written to a block device, or is to be stored in a bootimage, the extra
337pad bytes are not needed.
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100338
Phillip Lougher676fcce2014-08-08 21:27:38 +01003394. UNSQUASHFS
340-------------
341
342Unsquashfs allows you to decompress and extract a Squashfs filesystem without
343mounting it. It can extract the entire filesystem, or a specific
344file or directory.
345
346The Unsquashfs usage info is:
347
Phillip Lougher13b3f392014-08-08 21:46:45 +0100348SYNTAX: unsquashfs [options] filesystem [directories or files to extract]
349 -v[ersion] print version, licence and copyright information
350 -i[nfo] print files as they are unsquashed
351 -li[nfo] print files as they are unsquashed with file
352 attributes (like ls -l output)
353 -l[s] list filesystem, but don't unsquash
354 -ll[s] list filesystem with file attributes (like
355 ls -l output), but don't unsquash
356 -d[est] <pathname> unsquash to <pathname>, default "squashfs-root"
357 -f[orce] if file already exists then overwrite
358 -s[tat] display filesystem superblock information
359 -e[f] <extract file> list of directories or files to extract.
360 One per line
361 -r[egex] treat extract names as POSIX regular expressions
362 rather than use the default shell wildcard
363 expansion (globbing)
Phillip Lougher676fcce2014-08-08 21:27:38 +0100364
Phillip Lougher13b3f392014-08-08 21:46:45 +0100365To extract a subset of the filesystem, the filenames or directory
366trees that are to be extracted can now be specified on the command line. The
367files/directories should be specified using the full path to the
368files/directories as they appear within the Squashfs filesystem. The
369files/directories will also be extracted to those positions within the specified
370destination directory.
Phillip Lougher676fcce2014-08-08 21:27:38 +0100371
Phillip Lougher13b3f392014-08-08 21:46:45 +0100372Please refer to the README-3.3 file for a description of the new wildcard
373pattern matching functionality for extract files.
Phillip Lougher676fcce2014-08-08 21:27:38 +0100374
375The "-ls" option can be used to list the contents of a filesystem without
376decompressing the filesystem data itself.
377
378The "-info" option forces Unsquashfs to print each file as it is decompressed.
379
380The "-dest" option specifies the directory that is used to decompress
381the filesystem data. If this option is not given then the filesystem is
382decompressed to the directory "squashfs-root" in the current working directory.
383
384The "-force" option forces Unsquashfs to output to the destination
385directory even if files or directories already exist. This allows you
386to update an existing directory tree, or to Unsquashfs to a partially
387filled directory. Without the "-force" option, Unsquashfs will
388refuse to overwrite any existing files, or to create any directories if they
389already exist. This is done to protect data in case of mistakes, and
390so the "-force" option should be used with caution.
391
Phillip Lougher13b3f392014-08-08 21:46:45 +0100392Unsquashfs can decompress all Squashfs filesystem versions, 1.x, 2.x and 3.x
393filesystems.
Phillip Lougher676fcce2014-08-08 21:27:38 +0100394
3955. FILESYSTEM LAYOUT
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100396--------------------
397
Phillip Lougherc11f0062014-08-08 20:39:26 +0100398Brief filesystem design notes follow for the original 1.x filesystem
Phillip Lougherd48c9e32014-08-08 21:34:13 +0100399layout. A description of the 2.x and 3.x filesystem layouts will be written
Phillip Lougher2bb74232014-08-08 21:24:28 +0100400sometime!
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100401
Phillip Lougherc11f0062014-08-08 20:39:26 +0100402A squashfs filesystem consists of five parts, packed together on a byte
403alignment:
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100404
405 ---------------
406| superblock |
407|---------------|
408| data|
409| blocks|
410|---------------|
411| inodes|
412|---------------|
413| directories|
414|---------------|
415| uid/gid|
416| lookup table|
417 ---------------
418
419Compressed data blocks are written to the filesystem as files are read from
420the source directory, and checked for duplicates. Once all file data has been
421written the completed inode, directory and uid/gid lookup tables are written.
422
Phillip Lougher676fcce2014-08-08 21:27:38 +01004235.1 Metadata
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100424------------
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100425
426Metadata (inodes and directories) are compressed in 8Kbyte blocks. Each
427compressed block is prefixed by a two byte length, the top bit is set if the
428block is uncompressed. A block will be uncompressed if the -noI option is set,
429or if the compressed block was larger than the uncompressed block.
430
431Inodes are packed into the metadata blocks, and are not aligned to block
432boundaries, therefore inodes overlap compressed blocks. An inode is
433identified by a two field tuple <start address of compressed block : offset
434into de-compressed block>.
435
436Inode contents vary depending on the file type. The base inode consists of:
437
438base inode:
439Inode type
440Mode
441uid index
442gid index
443
444The inode type is 4 bits in size, and the mode is 12 bits.
445
446The uid and gid indexes are 4 bits in length. Ordinarily, this will allow 16
447unique indexes into the uid table. To minimise overhead, the uid index is
448used in conjunction with the spare bit in the file type to form a 48 entry
449index as follows:
450
451inode type 1 - 5: uid index = uid
452inode type 5 -10: uid index = 16 + uid
453inode type 11 - 15: uid index = 32 + uid
454
455In this way 48 unique uids are supported using 4 bits, minimising data inode
456overhead. The 4 bit gid index is used to index into a 15 entry gid table.
457Gid index 15 is used to indicate that the gid is the same as the uid.
458This prevents the 15 entry gid table filling up with the common case where
459the uid/gid is the same.
460
461The data contents of symbolic links are stored immediately after the symbolic
462link inode, inside the inode table. This allows the normally small symbolic
463link to be compressed as part of the inode table, achieving much greater
464compression than if the symbolic link was compressed individually.
465
466Similarly, the block index for regular files is stored immediately after the
467regular file inode. The block index is a list of block lengths (two bytes
468each), rather than block addresses, saving two bytes per block. The block
469address for a given block is computed by the summation of the previous
470block lengths. This takes advantage of the fact that the blocks making up a
471file are stored contiguously in the filesystem. The top bit of each block
472length is set if the block is uncompressed, either because the -noD option is
473set, or if the compressed block was larger than the uncompressed block.
474
Phillip Lougher676fcce2014-08-08 21:27:38 +01004755.2 Directories
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100476---------------
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100477
478Like inodes, directories are packed into the metadata blocks, and are not
479aligned on block boundaries, therefore directories can overlap compressed
480blocks. A directory is, again, identified by a two field tuple
481<start address of compressed block containing directory start : offset
482into de-compressed block>.
483
484Directories are organised in a slightly complex way, and are not simply
485a list of file names and inode tuples. The organisation takes advantage of the
486observation that in most cases, the inodes of the files in the directory
487will be in the same compressed metadata block, and therefore, the
488inode tuples will have the same start block.
489
490Directories are therefore organised in a two level list, a directory
491header containing the shared start block value, and a sequence of
492directory entries, each of which share the shared start block. A
493new directory header is written once/if the inode start block
494changes. The directory header/directory entry list is repeated as many times
495as necessary. The organisation is as follows:
496
497directory_header:
498count (8 bits)
499inode start block (24 bits)
500
501directory entry: * count
502inode offset (13 bits)
503inode type (3 bits)
504filename size (8 bits)
505filename
506
507This organisation saves on average 3 bytes per filename.
508
Phillip Lougher676fcce2014-08-08 21:27:38 +01005095.3 File data
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100510-------------
Phillip Lougher9e37ac02014-08-08 05:15:38 +0100511
512File data is compressed on a block by block basis and written to the
513filesystem. The filesystem supports up to 32K blocks, which achieves
514greater compression ratios than the Linux 4K page size.
515
516The disadvantage with using greater than 4K blocks (and the reason why
517most filesystems do not), is that the VFS reads data in 4K pages.
518The filesystem reads and decompresses a larger block containing that page
519(e.g. 32K). However, only 4K can be returned to the VFS, resulting in a
520very inefficient filesystem, as 28K must be thrown away. Squashfs,
521solves this problem by explicitly pushing the extra pages into the page
522cache.
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100523
524
Phillip Lougher676fcce2014-08-08 21:27:38 +01005256. AUTHOR INFO
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100526--------------
527
Phillip Lougher2bb74232014-08-08 21:24:28 +0100528Squashfs was written by Phillip Lougher, email phillip@lougher.org.uk,
Phillip Lougher2ce29a92014-08-08 05:44:57 +0100529in Chepstow, Wales, UK. If you like the program, or have any problems,
530then please email me, as it's nice to get feedback!