xref: /OK3568_Linux_fs/kernel/Documentation/filesystems/ext4/about.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunAbout this Book
4*4882a593Smuzhiyun===============
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThis document attempts to describe the on-disk format for ext4
7*4882a593Smuzhiyunfilesystems. The same general ideas should apply to ext2/3 filesystems
8*4882a593Smuzhiyunas well, though they do not support all the features that ext4 supports,
9*4882a593Smuzhiyunand the fields will be shorter.
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun**NOTE**: This is a work in progress, based on notes that the author
12*4882a593Smuzhiyun(djwong) made while picking apart a filesystem by hand. The data
13*4882a593Smuzhiyunstructure definitions should be current as of Linux 4.18 and
14*4882a593Smuzhiyune2fsprogs-1.44. All comments and corrections are welcome, since there is
15*4882a593Smuzhiyunundoubtedly plenty of lore that might not be reflected in freshly
16*4882a593Smuzhiyuncreated demonstration filesystems.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunLicense
19*4882a593Smuzhiyun-------
20*4882a593SmuzhiyunThis book is licensed under the terms of the GNU Public License, v2.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunTerminology
23*4882a593Smuzhiyun-----------
24*4882a593Smuzhiyun
25*4882a593Smuzhiyunext4 divides a storage device into an array of logical blocks both to
26*4882a593Smuzhiyunreduce bookkeeping overhead and to increase throughput by forcing larger
27*4882a593Smuzhiyuntransfer sizes. Generally, the block size will be 4KiB (the same size as
28*4882a593Smuzhiyunpages on x86 and the block layer's default block size), though the
29*4882a593Smuzhiyunactual size is calculated as 2 ^ (10 + ``sb.s_log_block_size``) bytes.
30*4882a593SmuzhiyunThroughout this document, disk locations are given in terms of these
31*4882a593Smuzhiyunlogical blocks, not raw LBAs, and not 1024-byte blocks. For the sake of
32*4882a593Smuzhiyunconvenience, the logical block size will be referred to as
33*4882a593Smuzhiyun``$block_size`` throughout the rest of the document.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunWhen referenced in ``preformatted text`` blocks, ``sb`` refers to fields
36*4882a593Smuzhiyunin the super block, and ``inode`` refers to fields in an inode table
37*4882a593Smuzhiyunentry.
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunOther References
40*4882a593Smuzhiyun----------------
41*4882a593Smuzhiyun
42*4882a593SmuzhiyunAlso see https://www.nongnu.org/ext2-doc/ for quite a collection of
43*4882a593Smuzhiyuninformation about ext2/3. Here's another old reference:
44*4882a593Smuzhiyunhttp://wiki.osdev.org/Ext2
45