18a98ec7cSDarrick J. Wong.. SPDX-License-Identifier: GPL-2.0 28a98ec7cSDarrick J. Wong 38a98ec7cSDarrick J. WongAbout this Book 48a98ec7cSDarrick J. Wong=============== 58a98ec7cSDarrick J. Wong 68a98ec7cSDarrick J. WongThis document attempts to describe the on-disk format for ext4 78a98ec7cSDarrick J. Wongfilesystems. The same general ideas should apply to ext2/3 filesystems 88a98ec7cSDarrick J. Wongas well, though they do not support all the features that ext4 supports, 98a98ec7cSDarrick J. Wongand the fields will be shorter. 108a98ec7cSDarrick J. Wong 118a98ec7cSDarrick J. Wong**NOTE**: This is a work in progress, based on notes that the author 128a98ec7cSDarrick J. Wong(djwong) made while picking apart a filesystem by hand. The data 138a98ec7cSDarrick J. Wongstructure definitions should be current as of Linux 4.18 and 148a98ec7cSDarrick J. Wonge2fsprogs-1.44. All comments and corrections are welcome, since there is 158a98ec7cSDarrick J. Wongundoubtedly plenty of lore that might not be reflected in freshly 168a98ec7cSDarrick J. Wongcreated demonstration filesystems. 178a98ec7cSDarrick J. Wong 188a98ec7cSDarrick J. WongLicense 198a98ec7cSDarrick J. Wong------- 208a98ec7cSDarrick J. WongThis book is licensed under the terms of the GNU Public License, v2. 218a98ec7cSDarrick J. Wong 228a98ec7cSDarrick J. WongTerminology 238a98ec7cSDarrick J. Wong----------- 248a98ec7cSDarrick J. Wong 258a98ec7cSDarrick J. Wongext4 divides a storage device into an array of logical blocks both to 268a98ec7cSDarrick J. Wongreduce bookkeeping overhead and to increase throughput by forcing larger 278a98ec7cSDarrick J. Wongtransfer sizes. Generally, the block size will be 4KiB (the same size as 288a98ec7cSDarrick J. Wongpages on x86 and the block layer's default block size), though the 298a98ec7cSDarrick J. Wongactual size is calculated as 2 ^ (10 + ``sb.s_log_block_size``) bytes. 308a98ec7cSDarrick J. WongThroughout this document, disk locations are given in terms of these 318a98ec7cSDarrick J. Wonglogical blocks, not raw LBAs, and not 1024-byte blocks. For the sake of 328a98ec7cSDarrick J. Wongconvenience, the logical block size will be referred to as 338a98ec7cSDarrick J. Wong``$block_size`` throughout the rest of the document. 348a98ec7cSDarrick J. Wong 358a98ec7cSDarrick J. WongWhen referenced in ``preformatted text`` blocks, ``sb`` refers to fields 368a98ec7cSDarrick J. Wongin the super block, and ``inode`` refers to fields in an inode table 378a98ec7cSDarrick J. Wongentry. 388a98ec7cSDarrick J. Wong 398a98ec7cSDarrick J. WongOther References 408a98ec7cSDarrick J. Wong---------------- 418a98ec7cSDarrick J. Wong 42*e65bf6e4SAlexander A. KlimovAlso see https://www.nongnu.org/ext2-doc/ for quite a collection of 438a98ec7cSDarrick J. Wonginformation about ext2/3. Here's another old reference: 448a98ec7cSDarrick J. Wonghttp://wiki.osdev.org/Ext2 45