1*79398b25SAndroid Build Coastguard WorkerNOTE: This the original README for version 2.0. It is retained as it 2*79398b25SAndroid Build Coastguard Workercontains information about the fragment design. A description of the new 2.0 3*79398b25SAndroid Build Coastguard Workermksquashfs options has been added to the main README file, and that 4*79398b25SAndroid Build Coastguard Workerfile should now be consulted for these. 5*79398b25SAndroid Build Coastguard Worker 6*79398b25SAndroid Build Coastguard Worker SQUASHFS 2.0 - A squashed read-only filesystem for Linux 7*79398b25SAndroid Build Coastguard Worker 8*79398b25SAndroid Build Coastguard Worker Copyright 2004 Phillip Lougher ([email protected]) 9*79398b25SAndroid Build Coastguard Worker 10*79398b25SAndroid Build Coastguard Worker Released under the GPL licence (version 2 or later). 11*79398b25SAndroid Build Coastguard Worker 12*79398b25SAndroid Build Coastguard WorkerWelcome to the final release of Squashfs version 2.0! A lot of changes to the 13*79398b25SAndroid Build Coastguard Workerfilesystem have been made under the bonnet (hood). Squashfs 2.0 uses fragment 14*79398b25SAndroid Build Coastguard Workerblocks and larger blocks (64K) to improve compression ratio by about 5 - 20% 15*79398b25SAndroid Build Coastguard Workerover Squashfs 1.0 depending on the files being compressed. Using fragment 16*79398b25SAndroid Build Coastguard Workerblocks allows Squashfs 2.0 to achieve better compression than cloop and similar 17*79398b25SAndroid Build Coastguard Workercompression to tgz files while retaining the I/O efficiency of a compressed 18*79398b25SAndroid Build Coastguard Workerfilesystem. 19*79398b25SAndroid Build Coastguard Worker 20*79398b25SAndroid Build Coastguard WorkerDetailed changes: 21*79398b25SAndroid Build Coastguard Worker 22*79398b25SAndroid Build Coastguard Worker1. Squashfs 2.0 has added the concept of fragment blocks (see later discussion). 23*79398b25SAndroid Build Coastguard Worker Files smaller than the file block size (64K in Squashfs 2.0) and optionally 24*79398b25SAndroid Build Coastguard Worker the remainder of files that do not fit fully into a block (i.e. the last 32K 25*79398b25SAndroid Build Coastguard Worker in a 96K file) are packed into shared fragments and compressed together. 26*79398b25SAndroid Build Coastguard Worker This achieves on average 5 - 20% better compression than Squashfs 1.x. 27*79398b25SAndroid Build Coastguard Worker 28*79398b25SAndroid Build Coastguard Worker2. The maximum block size has been increased to 64K. 29*79398b25SAndroid Build Coastguard Worker 30*79398b25SAndroid Build Coastguard Worker3. The maximum number of UIDs has been increased to 256 (from 48 in 1.x). 31*79398b25SAndroid Build Coastguard Worker 32*79398b25SAndroid Build Coastguard Worker4. The maximum number of GIDs has been increased to 256 (from 15 in 1.x). 33*79398b25SAndroid Build Coastguard Worker 34*79398b25SAndroid Build Coastguard Worker5. New mksquashfs -all-root, -root-owned, -force-uid, and -force-gid 35*79398b25SAndroid Build Coastguard Worker options. These allow the uids/gids of files in the generated 36*79398b25SAndroid Build Coastguard Worker filesystem to be specified, overriding the uids/gids in the 37*79398b25SAndroid Build Coastguard Worker source filesystem. 38*79398b25SAndroid Build Coastguard Worker 39*79398b25SAndroid Build Coastguard Worker6. Initrds are now supported for kernels 2.6.x. 40*79398b25SAndroid Build Coastguard Worker 41*79398b25SAndroid Build Coastguard Worker7. Removal of sleep_on() function call in 2.6.x patch, to allow Squashfs 42*79398b25SAndroid Build Coastguard Worker to work on the Fedora rc2 kernel. 43*79398b25SAndroid Build Coastguard Worker 44*79398b25SAndroid Build Coastguard Worker8. AMD64, check-data and gid bug fixes. 45*79398b25SAndroid Build Coastguard Worker 46*79398b25SAndroid Build Coastguard Worker9. Numerous small bug fixes have been made. 47*79398b25SAndroid Build Coastguard Worker 48*79398b25SAndroid Build Coastguard Worker10. New patch for Linux 2.6.7. 49*79398b25SAndroid Build Coastguard Worker 50*79398b25SAndroid Build Coastguard Worker 51*79398b25SAndroid Build Coastguard WorkerNew Squashfs 2.0 options 52*79398b25SAndroid Build Coastguard Worker------------------------ 53*79398b25SAndroid Build Coastguard Worker 54*79398b25SAndroid Build Coastguard Worker-noF or -noFragmentCompression 55*79398b25SAndroid Build Coastguard Worker 56*79398b25SAndroid Build Coastguard Worker Do not compress the fragments. Added for compatibility with noI and 57*79398b25SAndroid Build Coastguard Worker noD, probably not that useful. 58*79398b25SAndroid Build Coastguard Worker 59*79398b25SAndroid Build Coastguard Worker-no-fragments 60*79398b25SAndroid Build Coastguard Worker 61*79398b25SAndroid Build Coastguard Worker Do not use fragment blocks, and rather generate a filesystem 62*79398b25SAndroid Build Coastguard Worker similar to a Squashfs 1.x filesystem. It will of course still 63*79398b25SAndroid Build Coastguard Worker be a Squashfs 2.0 filesystem but without fragments, and so 64*79398b25SAndroid Build Coastguard Worker it won't be mountable on a Squashfs 1.x system. 65*79398b25SAndroid Build Coastguard Worker 66*79398b25SAndroid Build Coastguard Worker-always-use-fragments 67*79398b25SAndroid Build Coastguard Worker 68*79398b25SAndroid Build Coastguard Worker By default only small files less than the block size are packed into 69*79398b25SAndroid Build Coastguard Worker fragment blocks. The ends of files which do not fit fully into a block, 70*79398b25SAndroid Build Coastguard Worker are NOT by default packed into fragments. To illustrate this, a 71*79398b25SAndroid Build Coastguard Worker 100K file has an initial 64K block and a 36K remainder. This 72*79398b25SAndroid Build Coastguard Worker 36K remainder is not packed into a fragment by default. This is 73*79398b25SAndroid Build Coastguard Worker because to do so leads to a 10 - 20% drop in sequential I/O 74*79398b25SAndroid Build Coastguard Worker performance, as a disk head seek is needed to seek to the initial 75*79398b25SAndroid Build Coastguard Worker file data and another disk seek is need to seek to the fragment 76*79398b25SAndroid Build Coastguard Worker block. 77*79398b25SAndroid Build Coastguard Worker 78*79398b25SAndroid Build Coastguard Worker Specify this option if you want file remainders to be packed into 79*79398b25SAndroid Build Coastguard Worker fragment blocks. Doing so may increase the compression obtained 80*79398b25SAndroid Build Coastguard Worker BUT at the expense of I/O speed. 81*79398b25SAndroid Build Coastguard Worker 82*79398b25SAndroid Build Coastguard Worker-no-duplicates 83*79398b25SAndroid Build Coastguard Worker 84*79398b25SAndroid Build Coastguard Worker Do not detect duplicate files. 85*79398b25SAndroid Build Coastguard Worker 86*79398b25SAndroid Build Coastguard Worker-all-root 87*79398b25SAndroid Build Coastguard Worker-root-owned 88*79398b25SAndroid Build Coastguard Worker 89*79398b25SAndroid Build Coastguard Worker These options (both do exactly the same thing), force all file 90*79398b25SAndroid Build Coastguard Worker uids/gids in the generated Squashfs filesystem to be root. 91*79398b25SAndroid Build Coastguard Worker This allows root owned filesystems to be built without root access 92*79398b25SAndroid Build Coastguard Worker on the host machine. 93*79398b25SAndroid Build Coastguard Worker 94*79398b25SAndroid Build Coastguard Worker-force-uid uid 95*79398b25SAndroid Build Coastguard Worker 96*79398b25SAndroid Build Coastguard Worker This option forces all files in the generated Squashfs filesystem to 97*79398b25SAndroid Build Coastguard Worker be owned by the specified uid. The uid can be specified either by 98*79398b25SAndroid Build Coastguard Worker name (i.e. "root") or by number. 99*79398b25SAndroid Build Coastguard Worker 100*79398b25SAndroid Build Coastguard Worker-force-gid gid 101*79398b25SAndroid Build Coastguard Worker 102*79398b25SAndroid Build Coastguard Worker This option forces all files in the generated Squashfs filesystem to 103*79398b25SAndroid Build Coastguard Worker be group owned by the specified gid. The gid can be specified either by 104*79398b25SAndroid Build Coastguard Worker name (i.e. "root") or by number. 105*79398b25SAndroid Build Coastguard Worker 106*79398b25SAndroid Build Coastguard Worker 107*79398b25SAndroid Build Coastguard WorkerCompression improvements example 108*79398b25SAndroid Build Coastguard Worker-------------------------------- 109*79398b25SAndroid Build Coastguard Worker 110*79398b25SAndroid Build Coastguard WorkerThe following is the compression results obtained compressing the 2.6.6 111*79398b25SAndroid Build Coastguard Workerlinux kernel source using CRAMFS, Cloop (with iso filesystem), Squashfs 1.3 and 112*79398b25SAndroid Build Coastguard WorkerSquashfs 2.0 (results generated using big-endian filesystems). 113*79398b25SAndroid Build Coastguard Worker 114*79398b25SAndroid Build Coastguard WorkerIn decreasing order of size: 115*79398b25SAndroid Build Coastguard Worker 116*79398b25SAndroid Build Coastguard Worker CRAMFS 62791680 bytes (59.9M) 117*79398b25SAndroid Build Coastguard Worker Squashfs 1.x 51351552 bytes (48.9M) 118*79398b25SAndroid Build Coastguard Worker Cloop 46118681 bytes (44.0M) 119*79398b25SAndroid Build Coastguard Worker Squashfs 2.0 45604854 bytes (43.5M) 120*79398b25SAndroid Build Coastguard Worker 121*79398b25SAndroid Build Coastguard Worker 122*79398b25SAndroid Build Coastguard WorkerThe Squashfs 1.x filesystem is 12.6% larger than the new 2.0 filesystem. 123*79398b25SAndroid Build Coastguard WorkerThe cloop filesystem is 1.1% larger than the Squashfs 2.0 filesystem. 124*79398b25SAndroid Build Coastguard Worker 125*79398b25SAndroid Build Coastguard Worker 126*79398b25SAndroid Build Coastguard WorkerFragment blocks in Squashfs 2.0 127*79398b25SAndroid Build Coastguard Worker------------------------------- 128*79398b25SAndroid Build Coastguard Worker 129*79398b25SAndroid Build Coastguard WorkerSquashfs like all other compressed filesystems compresses files individually 130*79398b25SAndroid Build Coastguard Workeron a block by block basis. This is performed to allow mounting and 131*79398b25SAndroid Build Coastguard Workerde-compression of files on a block by block basis without requiring the entire 132*79398b25SAndroid Build Coastguard Workerfilesystem to be decompressed. This is in contrast to data-based compression 133*79398b25SAndroid Build Coastguard Workerschemes which compress without understanding the underlying filesystem (i.e. 134*79398b25SAndroid Build Coastguard Workercloop and tgz files) and which, therefore, do not compress files individually. 135*79398b25SAndroid Build Coastguard WorkerEach approach has advantages and disadvantages, data-based systems have better 136*79398b25SAndroid Build Coastguard Workercompression because compression is always performed at the maximum block size 137*79398b25SAndroid Build Coastguard Worker(64K in cloop) irrespective of the size of each file (which could be less than 138*79398b25SAndroid Build Coastguard Workerthe block size). Compressed filesystems tend to be faster at I/O because 139*79398b25SAndroid Build Coastguard Workerthey understand the filesystem and therefore employ better caching stategies 140*79398b25SAndroid Build Coastguard Workerand read less un-needed data from the filesystem. 141*79398b25SAndroid Build Coastguard Worker 142*79398b25SAndroid Build Coastguard WorkerFragment blocks in Squashfs 2.0 solves this problem by packing files (and 143*79398b25SAndroid Build Coastguard Workeroptionally the ends of files) which are smaller than the block size into 144*79398b25SAndroid Build Coastguard Workershared blocks, which are compressed together. For example five files each of 145*79398b25SAndroid Build Coastguard Worker10K will be packed into one shared fragment of 50K and compressed together, 146*79398b25SAndroid Build Coastguard Workerrather than being compressed in five 10K blocks. 147*79398b25SAndroid Build Coastguard Worker 148*79398b25SAndroid Build Coastguard WorkerThis scheme produces a hybrid filesystem, retaining the I/O efficiency 149*79398b25SAndroid Build Coastguard Workerof a compressed filesystem, while obtaining the compression efficiency 150*79398b25SAndroid Build Coastguard Workerof data-based schemes by compressing small files together. 151*79398b25SAndroid Build Coastguard Worker 152*79398b25SAndroid Build Coastguard Worker 153*79398b25SAndroid Build Coastguard WorkerSquashfs 1.x and Squashfs 2.0 compatibility 154*79398b25SAndroid Build Coastguard Worker------------------------------------------- 155*79398b25SAndroid Build Coastguard Worker 156*79398b25SAndroid Build Coastguard WorkerAppending to Squashfs 1.x filesystems is not supported. If you wish to append 157*79398b25SAndroid Build Coastguard Workerto 1.x filesystems, then either use the original mksquashfs, or convert them 158*79398b25SAndroid Build Coastguard Workerto Squashfs 2.0 by mounting the filesystem and running the 2.0 mksquashfs 159*79398b25SAndroid Build Coastguard Workeron the mounted filesystem. 160*79398b25SAndroid Build Coastguard Worker 161*79398b25SAndroid Build Coastguard WorkerMounting Squashfs 1.x filesystems IS supported by the 2.0 kernel patch. 162