18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ciAbout this Book 48c2ecf20Sopenharmony_ci=============== 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ciThis document attempts to describe the on-disk format for ext4 78c2ecf20Sopenharmony_cifilesystems. The same general ideas should apply to ext2/3 filesystems 88c2ecf20Sopenharmony_cias well, though they do not support all the features that ext4 supports, 98c2ecf20Sopenharmony_ciand the fields will be shorter. 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci**NOTE**: This is a work in progress, based on notes that the author 128c2ecf20Sopenharmony_ci(djwong) made while picking apart a filesystem by hand. The data 138c2ecf20Sopenharmony_cistructure definitions should be current as of Linux 4.18 and 148c2ecf20Sopenharmony_cie2fsprogs-1.44. All comments and corrections are welcome, since there is 158c2ecf20Sopenharmony_ciundoubtedly plenty of lore that might not be reflected in freshly 168c2ecf20Sopenharmony_cicreated demonstration filesystems. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciLicense 198c2ecf20Sopenharmony_ci------- 208c2ecf20Sopenharmony_ciThis book is licensed under the terms of the GNU Public License, v2. 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciTerminology 238c2ecf20Sopenharmony_ci----------- 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ciext4 divides a storage device into an array of logical blocks both to 268c2ecf20Sopenharmony_cireduce bookkeeping overhead and to increase throughput by forcing larger 278c2ecf20Sopenharmony_citransfer sizes. Generally, the block size will be 4KiB (the same size as 288c2ecf20Sopenharmony_cipages on x86 and the block layer's default block size), though the 298c2ecf20Sopenharmony_ciactual size is calculated as 2 ^ (10 + ``sb.s_log_block_size``) bytes. 308c2ecf20Sopenharmony_ciThroughout this document, disk locations are given in terms of these 318c2ecf20Sopenharmony_cilogical blocks, not raw LBAs, and not 1024-byte blocks. For the sake of 328c2ecf20Sopenharmony_ciconvenience, the logical block size will be referred to as 338c2ecf20Sopenharmony_ci``$block_size`` throughout the rest of the document. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciWhen referenced in ``preformatted text`` blocks, ``sb`` refers to fields 368c2ecf20Sopenharmony_ciin the super block, and ``inode`` refers to fields in an inode table 378c2ecf20Sopenharmony_cientry. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciOther References 408c2ecf20Sopenharmony_ci---------------- 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciAlso see https://www.nongnu.org/ext2-doc/ for quite a collection of 438c2ecf20Sopenharmony_ciinformation about ext2/3. Here's another old reference: 448c2ecf20Sopenharmony_cihttp://wiki.osdev.org/Ext2 45