1 .. SPDX-License-Identifier: GPL-2.0 2 3 Layout 4 ------ 5 6 The layout of a standard block group is approx 7 of these fields is discussed in a separate sec 8 9 .. list-table:: 10 :widths: 1 1 1 1 1 1 1 1 11 :header-rows: 1 12 13 * - Group 0 Padding 14 - ext4 Super Block 15 - Group Descriptors 16 - Reserved GDT Blocks 17 - Data Block Bitmap 18 - inode Bitmap 19 - inode Table 20 - Data Blocks 21 * - 1024 bytes 22 - 1 block 23 - many blocks 24 - many blocks 25 - 1 block 26 - 1 block 27 - many blocks 28 - many more blocks 29 30 For the special case of block group 0, the fir 31 to allow for the installation of x86 boot sect 32 The superblock will start at offset 1024 bytes 33 happens to be (usually 0). However, if for som 34 1024, then block 0 is marked in use and the su 35 For all other block groups, there is no paddin 36 37 The ext4 driver primarily works with the super 38 descriptors that are found in block group 0. R 39 superblock and group descriptors are written t 40 across the disk in case the beginning of the d 41 not all block groups necessarily host a redund 42 paragraph for more details). If the group does 43 copy, the block group begins with the data blo 44 when the filesystem is freshly formatted, mkfs 45 GDT block” space after the block group descr 46 of the block bitmaps to allow for future expan 47 default, a filesystem is allowed to increase i 48 1024x over the original filesystem size. 49 50 The location of the inode table is given by `` 51 is continuous range of blocks large enough to 52 ``sb.s_inodes_per_group * sb.s_inode_size`` by 53 54 As for the ordering of items in a block group, 55 established that the super block and the group 56 present, will be at the beginning of the block 57 the inode table can be anywhere, and it is qui 58 bitmaps to come after the inode table, or for 59 groups (flex_bg). Leftover space is used for f 60 block maps, extent tree blocks, and extended a 61 62 Flexible Block Groups 63 --------------------- 64 65 Starting in ext4, there is a new feature calle 66 (flex_bg). In a flex_bg, several block groups 67 logical block group; the bitmap spaces and the 68 first block group of the flex_bg are expanded 69 and inode tables of all other block groups in 70 if the flex_bg size is 4, then group 0 will co 71 superblock, group descriptors, data block bitm 72 bitmaps for groups 0-3, inode tables for group 73 space in group 0 is for file data. The effect 74 block group metadata close together for faster 75 large files to be continuous on disk. Backup c 76 and group descriptors are always at the beginn 77 if flex_bg is enabled. The number of block gro 78 flex_bg is given by 2 ^ ``sb.s_log_groups_per_ 79 80 Meta Block Groups 81 ----------------- 82 83 Without the option META_BG, for safety concern 84 descriptors copies are kept in the first block 85 128MiB(2^27 bytes) block group size and 64-byt 86 can have at most 2^27/64 = 2^21 block groups. 87 filesystem size to 2^21 * 2^27 = 2^48bytes or 88 89 The solution to this problem is to use the met 90 (META_BG), which is already in ext3 for all 2. 91 META_BG feature, ext4 filesystems are partitio 92 groups. Each metablock group is a cluster of b 93 descriptor structures can be stored in a singl 94 filesystems with 4 KB block size, a single met 95 includes 64 block groups, or 8 GiB of disk spa 96 feature moves the location of the group descri 97 first block group of the whole filesystem into 98 metablock group itself. The backups are in the 99 each metablock group. This increases the 2^21 100 to the hard limit 2^32, allowing support for a 101 102 The change in the filesystem format replaces t 103 the superblock is followed by a variable-lengt 104 descriptors. Instead, the superblock and a sin 105 block is placed at the beginning of the first, 106 groups in a meta-block group. A meta-block gro 107 block groups which can be described by a singl 108 block. Since the size of the block group descr 109 bytes, a meta-block group contains 16 block gr 110 a 1KB block size, and 64 block groups for file 111 blocksize. Filesystems can either be created u 112 descriptor layout, or existing filesystems can 113 the field s_first_meta_bg in the superblock wi 114 block group using this new layout. 115 116 Please see an important note about ``BLOCK_UNI 117 block and inode bitmaps. 118 119 Lazy Block Group Initialization 120 ------------------------------- 121 122 A new feature for ext4 are three block group d 123 enable mkfs to skip initializing other parts o 124 metadata. Specifically, the INODE_UNINIT and B 125 that the inode and block bitmaps for that grou 126 therefore the on-disk bitmap blocks are not in 127 generally the case for an empty block group or 128 only fixed-location block group metadata. The 129 that the inode table has been initialized; mkf 130 rely on the kernel to initialize the inode tab 131 132 By not writing zeroes to the bitmaps and inode 133 reduced considerably. Note the feature flag is 134 but the dumpe2fs output prints this as “unin 135 thing.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.