Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 About this Book
0004 ===============
0005 
0006 This document attempts to describe the on-disk format for ext4
0007 filesystems. The same general ideas should apply to ext2/3 filesystems
0008 as well, though they do not support all the features that ext4 supports,
0009 and the fields will be shorter.
0010 
0011 **NOTE**: This is a work in progress, based on notes that the author
0012 (djwong) made while picking apart a filesystem by hand. The data
0013 structure definitions should be current as of Linux 4.18 and
0014 e2fsprogs-1.44. All comments and corrections are welcome, since there is
0015 undoubtedly plenty of lore that might not be reflected in freshly
0016 created demonstration filesystems.
0017 
0018 License
0019 -------
0020 This book is licensed under the terms of the GNU Public License, v2.
0021 
0022 Terminology
0023 -----------
0024 
0025 ext4 divides a storage device into an array of logical blocks both to
0026 reduce bookkeeping overhead and to increase throughput by forcing larger
0027 transfer sizes. Generally, the block size will be 4KiB (the same size as
0028 pages on x86 and the block layer's default block size), though the
0029 actual size is calculated as 2 ^ (10 + ``sb.s_log_block_size``) bytes.
0030 Throughout this document, disk locations are given in terms of these
0031 logical blocks, not raw LBAs, and not 1024-byte blocks. For the sake of
0032 convenience, the logical block size will be referred to as
0033 ``$block_size`` throughout the rest of the document.
0034 
0035 When referenced in ``preformatted text`` blocks, ``sb`` refers to fields
0036 in the super block, and ``inode`` refers to fields in an inode table
0037 entry.
0038 
0039 Other References
0040 ----------------
0041 
0042 Also see https://www.nongnu.org/ext2-doc/ for quite a collection of
0043 information about ext2/3. Here's another old reference:
0044 http://wiki.osdev.org/Ext2