Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0 |
| 2 | |
| 3 | Super Block |
| 4 | ----------- |
| 5 | |
| 6 | The superblock records various information about the enclosing |
| 7 | filesystem, such as block counts, inode counts, supported features, |
| 8 | maintenance information, and more. |
| 9 | |
| 10 | If the sparse\_super feature flag is set, redundant copies of the |
| 11 | superblock and group descriptors are kept only in the groups whose group |
| 12 | number is either 0 or a power of 3, 5, or 7. If the flag is not set, |
| 13 | redundant copies are kept in all groups. |
| 14 | |
| 15 | The superblock checksum is calculated against the superblock structure, |
| 16 | which includes the FS UUID. |
| 17 | |
| 18 | The ext4 superblock is laid out as follows in |
| 19 | ``struct ext4_super_block``: |
| 20 | |
| 21 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 22 | :widths: 8 8 24 40 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 23 | :header-rows: 1 |
| 24 | |
| 25 | * - Offset |
| 26 | - Size |
| 27 | - Name |
| 28 | - Description |
| 29 | * - 0x0 |
| 30 | - \_\_le32 |
| 31 | - s\_inodes\_count |
| 32 | - Total inode count. |
| 33 | * - 0x4 |
| 34 | - \_\_le32 |
| 35 | - s\_blocks\_count\_lo |
| 36 | - Total block count. |
| 37 | * - 0x8 |
| 38 | - \_\_le32 |
| 39 | - s\_r\_blocks\_count\_lo |
| 40 | - This number of blocks can only be allocated by the super-user. |
| 41 | * - 0xC |
| 42 | - \_\_le32 |
| 43 | - s\_free\_blocks\_count\_lo |
| 44 | - Free block count. |
| 45 | * - 0x10 |
| 46 | - \_\_le32 |
| 47 | - s\_free\_inodes\_count |
| 48 | - Free inode count. |
| 49 | * - 0x14 |
| 50 | - \_\_le32 |
| 51 | - s\_first\_data\_block |
| 52 | - First data block. This must be at least 1 for 1k-block filesystems and |
| 53 | is typically 0 for all other block sizes. |
| 54 | * - 0x18 |
| 55 | - \_\_le32 |
| 56 | - s\_log\_block\_size |
| 57 | - Block size is 2 ^ (10 + s\_log\_block\_size). |
| 58 | * - 0x1C |
| 59 | - \_\_le32 |
| 60 | - s\_log\_cluster\_size |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 61 | - Cluster size is 2 ^ (10 + s\_log\_cluster\_size) blocks if bigalloc is |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 62 | enabled. Otherwise s\_log\_cluster\_size must equal s\_log\_block\_size. |
| 63 | * - 0x20 |
| 64 | - \_\_le32 |
| 65 | - s\_blocks\_per\_group |
| 66 | - Blocks per group. |
| 67 | * - 0x24 |
| 68 | - \_\_le32 |
| 69 | - s\_clusters\_per\_group |
| 70 | - Clusters per group, if bigalloc is enabled. Otherwise |
| 71 | s\_clusters\_per\_group must equal s\_blocks\_per\_group. |
| 72 | * - 0x28 |
| 73 | - \_\_le32 |
| 74 | - s\_inodes\_per\_group |
| 75 | - Inodes per group. |
| 76 | * - 0x2C |
| 77 | - \_\_le32 |
| 78 | - s\_mtime |
| 79 | - Mount time, in seconds since the epoch. |
| 80 | * - 0x30 |
| 81 | - \_\_le32 |
| 82 | - s\_wtime |
| 83 | - Write time, in seconds since the epoch. |
| 84 | * - 0x34 |
| 85 | - \_\_le16 |
| 86 | - s\_mnt\_count |
| 87 | - Number of mounts since the last fsck. |
| 88 | * - 0x36 |
| 89 | - \_\_le16 |
| 90 | - s\_max\_mnt\_count |
| 91 | - Number of mounts beyond which a fsck is needed. |
| 92 | * - 0x38 |
| 93 | - \_\_le16 |
| 94 | - s\_magic |
| 95 | - Magic signature, 0xEF53 |
| 96 | * - 0x3A |
| 97 | - \_\_le16 |
| 98 | - s\_state |
| 99 | - File system state. See super_state_ for more info. |
| 100 | * - 0x3C |
| 101 | - \_\_le16 |
| 102 | - s\_errors |
| 103 | - Behaviour when detecting errors. See super_errors_ for more info. |
| 104 | * - 0x3E |
| 105 | - \_\_le16 |
| 106 | - s\_minor\_rev\_level |
| 107 | - Minor revision level. |
| 108 | * - 0x40 |
| 109 | - \_\_le32 |
| 110 | - s\_lastcheck |
| 111 | - Time of last check, in seconds since the epoch. |
| 112 | * - 0x44 |
| 113 | - \_\_le32 |
| 114 | - s\_checkinterval |
| 115 | - Maximum time between checks, in seconds. |
| 116 | * - 0x48 |
| 117 | - \_\_le32 |
| 118 | - s\_creator\_os |
| 119 | - Creator OS. See the table super_creator_ for more info. |
| 120 | * - 0x4C |
| 121 | - \_\_le32 |
| 122 | - s\_rev\_level |
| 123 | - Revision level. See the table super_revision_ for more info. |
| 124 | * - 0x50 |
| 125 | - \_\_le16 |
| 126 | - s\_def\_resuid |
| 127 | - Default uid for reserved blocks. |
| 128 | * - 0x52 |
| 129 | - \_\_le16 |
| 130 | - s\_def\_resgid |
| 131 | - Default gid for reserved blocks. |
| 132 | * - |
| 133 | - |
| 134 | - |
| 135 | - These fields are for EXT4_DYNAMIC_REV superblocks only. |
| 136 | |
| 137 | Note: the difference between the compatible feature set and the |
| 138 | incompatible feature set is that if there is a bit set in the |
| 139 | incompatible feature set that the kernel doesn't know about, it should |
| 140 | refuse to mount the filesystem. |
| 141 | |
| 142 | e2fsck's requirements are more strict; if it doesn't know |
| 143 | about a feature in either the compatible or incompatible feature set, it |
| 144 | must abort and not try to meddle with things it doesn't understand... |
| 145 | * - 0x54 |
| 146 | - \_\_le32 |
| 147 | - s\_first\_ino |
| 148 | - First non-reserved inode. |
| 149 | * - 0x58 |
| 150 | - \_\_le16 |
| 151 | - s\_inode\_size |
| 152 | - Size of inode structure, in bytes. |
| 153 | * - 0x5A |
| 154 | - \_\_le16 |
| 155 | - s\_block\_group\_nr |
| 156 | - Block group # of this superblock. |
| 157 | * - 0x5C |
| 158 | - \_\_le32 |
| 159 | - s\_feature\_compat |
| 160 | - Compatible feature set flags. Kernel can still read/write this fs even |
| 161 | if it doesn't understand a flag; fsck should not do that. See the |
| 162 | super_compat_ table for more info. |
| 163 | * - 0x60 |
| 164 | - \_\_le32 |
| 165 | - s\_feature\_incompat |
| 166 | - Incompatible feature set. If the kernel or fsck doesn't understand one |
| 167 | of these bits, it should stop. See the super_incompat_ table for more |
| 168 | info. |
| 169 | * - 0x64 |
| 170 | - \_\_le32 |
| 171 | - s\_feature\_ro\_compat |
| 172 | - Readonly-compatible feature set. If the kernel doesn't understand one of |
| 173 | these bits, it can still mount read-only. See the super_rocompat_ table |
| 174 | for more info. |
| 175 | * - 0x68 |
| 176 | - \_\_u8 |
| 177 | - s\_uuid[16] |
| 178 | - 128-bit UUID for volume. |
| 179 | * - 0x78 |
| 180 | - char |
| 181 | - s\_volume\_name[16] |
| 182 | - Volume label. |
| 183 | * - 0x88 |
| 184 | - char |
| 185 | - s\_last\_mounted[64] |
| 186 | - Directory where filesystem was last mounted. |
| 187 | * - 0xC8 |
| 188 | - \_\_le32 |
| 189 | - s\_algorithm\_usage\_bitmap |
| 190 | - For compression (Not used in e2fsprogs/Linux) |
| 191 | * - |
| 192 | - |
| 193 | - |
| 194 | - Performance hints. Directory preallocation should only happen if the |
| 195 | EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on. |
| 196 | * - 0xCC |
| 197 | - \_\_u8 |
| 198 | - s\_prealloc\_blocks |
| 199 | - #. of blocks to try to preallocate for ... files? (Not used in |
| 200 | e2fsprogs/Linux) |
| 201 | * - 0xCD |
| 202 | - \_\_u8 |
| 203 | - s\_prealloc\_dir\_blocks |
| 204 | - #. of blocks to preallocate for directories. (Not used in |
| 205 | e2fsprogs/Linux) |
| 206 | * - 0xCE |
| 207 | - \_\_le16 |
| 208 | - s\_reserved\_gdt\_blocks |
| 209 | - Number of reserved GDT entries for future filesystem expansion. |
| 210 | * - |
| 211 | - |
| 212 | - |
| 213 | - Journalling support is valid only if EXT4_FEATURE_COMPAT_HAS_JOURNAL is |
| 214 | set. |
| 215 | * - 0xD0 |
| 216 | - \_\_u8 |
| 217 | - s\_journal\_uuid[16] |
| 218 | - UUID of journal superblock |
| 219 | * - 0xE0 |
| 220 | - \_\_le32 |
| 221 | - s\_journal\_inum |
| 222 | - inode number of journal file. |
| 223 | * - 0xE4 |
| 224 | - \_\_le32 |
| 225 | - s\_journal\_dev |
| 226 | - Device number of journal file, if the external journal feature flag is |
| 227 | set. |
| 228 | * - 0xE8 |
| 229 | - \_\_le32 |
| 230 | - s\_last\_orphan |
| 231 | - Start of list of orphaned inodes to delete. |
| 232 | * - 0xEC |
| 233 | - \_\_le32 |
| 234 | - s\_hash\_seed[4] |
| 235 | - HTREE hash seed. |
| 236 | * - 0xFC |
| 237 | - \_\_u8 |
| 238 | - s\_def\_hash\_version |
| 239 | - Default hash algorithm to use for directory hashes. See super_def_hash_ |
| 240 | for more info. |
| 241 | * - 0xFD |
| 242 | - \_\_u8 |
| 243 | - s\_jnl\_backup\_type |
| 244 | - If this value is 0 or EXT3\_JNL\_BACKUP\_BLOCKS (1), then the |
| 245 | ``s_jnl_blocks`` field contains a duplicate copy of the inode's |
| 246 | ``i_block[]`` array and ``i_size``. |
| 247 | * - 0xFE |
| 248 | - \_\_le16 |
| 249 | - s\_desc\_size |
| 250 | - Size of group descriptors, in bytes, if the 64bit incompat feature flag |
| 251 | is set. |
| 252 | * - 0x100 |
| 253 | - \_\_le32 |
| 254 | - s\_default\_mount\_opts |
| 255 | - Default mount options. See the super_mountopts_ table for more info. |
| 256 | * - 0x104 |
| 257 | - \_\_le32 |
| 258 | - s\_first\_meta\_bg |
| 259 | - First metablock block group, if the meta\_bg feature is enabled. |
| 260 | * - 0x108 |
| 261 | - \_\_le32 |
| 262 | - s\_mkfs\_time |
| 263 | - When the filesystem was created, in seconds since the epoch. |
| 264 | * - 0x10C |
| 265 | - \_\_le32 |
| 266 | - s\_jnl\_blocks[17] |
| 267 | - Backup copy of the journal inode's ``i_block[]`` array in the first 15 |
| 268 | elements and i\_size\_high and i\_size in the 16th and 17th elements, |
| 269 | respectively. |
| 270 | * - |
| 271 | - |
| 272 | - |
| 273 | - 64bit support is valid only if EXT4_FEATURE_COMPAT_64BIT is set. |
| 274 | * - 0x150 |
| 275 | - \_\_le32 |
| 276 | - s\_blocks\_count\_hi |
| 277 | - High 32-bits of the block count. |
| 278 | * - 0x154 |
| 279 | - \_\_le32 |
| 280 | - s\_r\_blocks\_count\_hi |
| 281 | - High 32-bits of the reserved block count. |
| 282 | * - 0x158 |
| 283 | - \_\_le32 |
| 284 | - s\_free\_blocks\_count\_hi |
| 285 | - High 32-bits of the free block count. |
| 286 | * - 0x15C |
| 287 | - \_\_le16 |
| 288 | - s\_min\_extra\_isize |
| 289 | - All inodes have at least # bytes. |
| 290 | * - 0x15E |
| 291 | - \_\_le16 |
| 292 | - s\_want\_extra\_isize |
| 293 | - New inodes should reserve # bytes. |
| 294 | * - 0x160 |
| 295 | - \_\_le32 |
| 296 | - s\_flags |
| 297 | - Miscellaneous flags. See the super_flags_ table for more info. |
| 298 | * - 0x164 |
| 299 | - \_\_le16 |
| 300 | - s\_raid\_stride |
| 301 | - RAID stride. This is the number of logical blocks read from or written |
| 302 | to the disk before moving to the next disk. This affects the placement |
| 303 | of filesystem metadata, which will hopefully make RAID storage faster. |
| 304 | * - 0x166 |
| 305 | - \_\_le16 |
| 306 | - s\_mmp\_interval |
| 307 | - #. seconds to wait in multi-mount prevention (MMP) checking. In theory, |
| 308 | MMP is a mechanism to record in the superblock which host and device |
| 309 | have mounted the filesystem, in order to prevent multiple mounts. This |
| 310 | feature does not seem to be implemented... |
| 311 | * - 0x168 |
| 312 | - \_\_le64 |
| 313 | - s\_mmp\_block |
| 314 | - Block # for multi-mount protection data. |
| 315 | * - 0x170 |
| 316 | - \_\_le32 |
| 317 | - s\_raid\_stripe\_width |
| 318 | - RAID stripe width. This is the number of logical blocks read from or |
| 319 | written to the disk before coming back to the current disk. This is used |
| 320 | by the block allocator to try to reduce the number of read-modify-write |
| 321 | operations in a RAID5/6. |
| 322 | * - 0x174 |
| 323 | - \_\_u8 |
| 324 | - s\_log\_groups\_per\_flex |
| 325 | - Size of a flexible block group is 2 ^ ``s_log_groups_per_flex``. |
| 326 | * - 0x175 |
| 327 | - \_\_u8 |
| 328 | - s\_checksum\_type |
| 329 | - Metadata checksum algorithm type. The only valid value is 1 (crc32c). |
| 330 | * - 0x176 |
| 331 | - \_\_le16 |
| 332 | - s\_reserved\_pad |
| 333 | - |
| 334 | * - 0x178 |
| 335 | - \_\_le64 |
| 336 | - s\_kbytes\_written |
| 337 | - Number of KiB written to this filesystem over its lifetime. |
| 338 | * - 0x180 |
| 339 | - \_\_le32 |
| 340 | - s\_snapshot\_inum |
| 341 | - inode number of active snapshot. (Not used in e2fsprogs/Linux.) |
| 342 | * - 0x184 |
| 343 | - \_\_le32 |
| 344 | - s\_snapshot\_id |
| 345 | - Sequential ID of active snapshot. (Not used in e2fsprogs/Linux.) |
| 346 | * - 0x188 |
| 347 | - \_\_le64 |
| 348 | - s\_snapshot\_r\_blocks\_count |
| 349 | - Number of blocks reserved for active snapshot's future use. (Not used in |
| 350 | e2fsprogs/Linux.) |
| 351 | * - 0x190 |
| 352 | - \_\_le32 |
| 353 | - s\_snapshot\_list |
| 354 | - inode number of the head of the on-disk snapshot list. (Not used in |
| 355 | e2fsprogs/Linux.) |
| 356 | * - 0x194 |
| 357 | - \_\_le32 |
| 358 | - s\_error\_count |
| 359 | - Number of errors seen. |
| 360 | * - 0x198 |
| 361 | - \_\_le32 |
| 362 | - s\_first\_error\_time |
| 363 | - First time an error happened, in seconds since the epoch. |
| 364 | * - 0x19C |
| 365 | - \_\_le32 |
| 366 | - s\_first\_error\_ino |
| 367 | - inode involved in first error. |
| 368 | * - 0x1A0 |
| 369 | - \_\_le64 |
| 370 | - s\_first\_error\_block |
| 371 | - Number of block involved of first error. |
| 372 | * - 0x1A8 |
| 373 | - \_\_u8 |
| 374 | - s\_first\_error\_func[32] |
| 375 | - Name of function where the error happened. |
| 376 | * - 0x1C8 |
| 377 | - \_\_le32 |
| 378 | - s\_first\_error\_line |
| 379 | - Line number where error happened. |
| 380 | * - 0x1CC |
| 381 | - \_\_le32 |
| 382 | - s\_last\_error\_time |
| 383 | - Time of most recent error, in seconds since the epoch. |
| 384 | * - 0x1D0 |
| 385 | - \_\_le32 |
| 386 | - s\_last\_error\_ino |
| 387 | - inode involved in most recent error. |
| 388 | * - 0x1D4 |
| 389 | - \_\_le32 |
| 390 | - s\_last\_error\_line |
| 391 | - Line number where most recent error happened. |
| 392 | * - 0x1D8 |
| 393 | - \_\_le64 |
| 394 | - s\_last\_error\_block |
| 395 | - Number of block involved in most recent error. |
| 396 | * - 0x1E0 |
| 397 | - \_\_u8 |
| 398 | - s\_last\_error\_func[32] |
| 399 | - Name of function where the most recent error happened. |
| 400 | * - 0x200 |
| 401 | - \_\_u8 |
| 402 | - s\_mount\_opts[64] |
| 403 | - ASCIIZ string of mount options. |
| 404 | * - 0x240 |
| 405 | - \_\_le32 |
| 406 | - s\_usr\_quota\_inum |
| 407 | - Inode number of user `quota <quota>`__ file. |
| 408 | * - 0x244 |
| 409 | - \_\_le32 |
| 410 | - s\_grp\_quota\_inum |
| 411 | - Inode number of group `quota <quota>`__ file. |
| 412 | * - 0x248 |
| 413 | - \_\_le32 |
| 414 | - s\_overhead\_blocks |
| 415 | - Overhead blocks/clusters in fs. (Huh? This field is always zero, which |
| 416 | means that the kernel calculates it dynamically.) |
| 417 | * - 0x24C |
| 418 | - \_\_le32 |
| 419 | - s\_backup\_bgs[2] |
| 420 | - Block groups containing superblock backups (if sparse\_super2) |
| 421 | * - 0x254 |
| 422 | - \_\_u8 |
| 423 | - s\_encrypt\_algos[4] |
| 424 | - Encryption algorithms in use. There can be up to four algorithms in use |
| 425 | at any time; valid algorithm codes are given in the super_encrypt_ table |
| 426 | below. |
| 427 | * - 0x258 |
| 428 | - \_\_u8 |
| 429 | - s\_encrypt\_pw\_salt[16] |
| 430 | - Salt for the string2key algorithm for encryption. |
| 431 | * - 0x268 |
| 432 | - \_\_le32 |
| 433 | - s\_lpf\_ino |
| 434 | - Inode number of lost+found |
| 435 | * - 0x26C |
| 436 | - \_\_le32 |
| 437 | - s\_prj\_quota\_inum |
| 438 | - Inode that tracks project quotas. |
| 439 | * - 0x270 |
| 440 | - \_\_le32 |
| 441 | - s\_checksum\_seed |
| 442 | - Checksum seed used for metadata\_csum calculations. This value is |
| 443 | crc32c(~0, $orig\_fs\_uuid). |
| 444 | * - 0x274 |
Darrick J. Wong | f5cb282 | 2018-07-29 16:16:21 -0400 | [diff] [blame] | 445 | - \_\_u8 |
| 446 | - s\_wtime_hi |
| 447 | - Upper 8 bits of the s_wtime field. |
| 448 | * - 0x275 |
| 449 | - \_\_u8 |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 450 | - s\_mtime_hi |
Darrick J. Wong | f5cb282 | 2018-07-29 16:16:21 -0400 | [diff] [blame] | 451 | - Upper 8 bits of the s_mtime field. |
| 452 | * - 0x276 |
| 453 | - \_\_u8 |
| 454 | - s\_mkfs_time_hi |
| 455 | - Upper 8 bits of the s_mkfs_time field. |
| 456 | * - 0x277 |
| 457 | - \_\_u8 |
| 458 | - s\_lastcheck_hi |
| 459 | - Upper 8 bits of the s_lastcheck_hi field. |
| 460 | * - 0x278 |
| 461 | - \_\_u8 |
| 462 | - s\_first_error_time_hi |
| 463 | - Upper 8 bits of the s_first_error_time_hi field. |
| 464 | * - 0x279 |
| 465 | - \_\_u8 |
| 466 | - s\_last_error_time_hi |
| 467 | - Upper 8 bits of the s_last_error_time_hi field. |
| 468 | * - 0x27A |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 469 | - \_\_u8 |
| 470 | - s\_pad[2] |
Darrick J. Wong | f5cb282 | 2018-07-29 16:16:21 -0400 | [diff] [blame] | 471 | - Zero padding. |
| 472 | * - 0x27C |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 473 | - \_\_le16 |
| 474 | - s\_encoding |
| 475 | - Filename charset encoding. |
| 476 | * - 0x27E |
| 477 | - \_\_le16 |
| 478 | - s\_encoding_flags |
| 479 | - Filename charset encoding flags. |
| 480 | * - 0x280 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 481 | - \_\_le32 |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 482 | - s\_reserved[95] |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 483 | - Padding to the end of the block. |
| 484 | * - 0x3FC |
| 485 | - \_\_le32 |
| 486 | - s\_checksum |
| 487 | - Superblock checksum. |
| 488 | |
| 489 | .. _super_state: |
| 490 | |
| 491 | The superblock state is some combination of the following: |
| 492 | |
| 493 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 494 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 495 | :header-rows: 1 |
| 496 | |
| 497 | * - Value |
| 498 | - Description |
| 499 | * - 0x0001 |
| 500 | - Cleanly umounted |
| 501 | * - 0x0002 |
| 502 | - Errors detected |
| 503 | * - 0x0004 |
| 504 | - Orphans being recovered |
| 505 | |
| 506 | .. _super_errors: |
| 507 | |
| 508 | The superblock error policy is one of the following: |
| 509 | |
| 510 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 511 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 512 | :header-rows: 1 |
| 513 | |
| 514 | * - Value |
| 515 | - Description |
| 516 | * - 1 |
| 517 | - Continue |
| 518 | * - 2 |
| 519 | - Remount read-only |
| 520 | * - 3 |
| 521 | - Panic |
| 522 | |
| 523 | .. _super_creator: |
| 524 | |
| 525 | The filesystem creator is one of the following: |
| 526 | |
| 527 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 528 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 529 | :header-rows: 1 |
| 530 | |
| 531 | * - Value |
| 532 | - Description |
| 533 | * - 0 |
| 534 | - Linux |
| 535 | * - 1 |
| 536 | - Hurd |
| 537 | * - 2 |
| 538 | - Masix |
| 539 | * - 3 |
| 540 | - FreeBSD |
| 541 | * - 4 |
| 542 | - Lites |
| 543 | |
| 544 | .. _super_revision: |
| 545 | |
| 546 | The superblock revision is one of the following: |
| 547 | |
| 548 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 549 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 550 | :header-rows: 1 |
| 551 | |
| 552 | * - Value |
| 553 | - Description |
| 554 | * - 0 |
| 555 | - Original format |
| 556 | * - 1 |
| 557 | - v2 format w/ dynamic inode sizes |
| 558 | |
| 559 | Note that ``EXT4_DYNAMIC_REV`` refers to a revision 1 or newer filesystem. |
| 560 | |
| 561 | .. _super_compat: |
| 562 | |
| 563 | The superblock compatible features field is a combination of any of the |
| 564 | following: |
| 565 | |
| 566 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 567 | :widths: 16 64 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 568 | :header-rows: 1 |
| 569 | |
| 570 | * - Value |
| 571 | - Description |
| 572 | * - 0x1 |
| 573 | - Directory preallocation (COMPAT\_DIR\_PREALLOC). |
| 574 | * - 0x2 |
| 575 | - “imagic inodes”. Not clear from the code what this does |
| 576 | (COMPAT\_IMAGIC\_INODES). |
| 577 | * - 0x4 |
| 578 | - Has a journal (COMPAT\_HAS\_JOURNAL). |
| 579 | * - 0x8 |
| 580 | - Supports extended attributes (COMPAT\_EXT\_ATTR). |
| 581 | * - 0x10 |
| 582 | - Has reserved GDT blocks for filesystem expansion |
| 583 | (COMPAT\_RESIZE\_INODE). Requires RO\_COMPAT\_SPARSE\_SUPER. |
| 584 | * - 0x20 |
| 585 | - Has directory indices (COMPAT\_DIR\_INDEX). |
| 586 | * - 0x40 |
| 587 | - “Lazy BG”. Not in Linux kernel, seems to have been for uninitialized |
| 588 | block groups? (COMPAT\_LAZY\_BG) |
| 589 | * - 0x80 |
| 590 | - “Exclude inode”. Not used. (COMPAT\_EXCLUDE\_INODE). |
| 591 | * - 0x100 |
| 592 | - “Exclude bitmap”. Seems to be used to indicate the presence of |
| 593 | snapshot-related exclude bitmaps? Not defined in kernel or used in |
| 594 | e2fsprogs (COMPAT\_EXCLUDE\_BITMAP). |
| 595 | * - 0x200 |
| 596 | - Sparse Super Block, v2. If this flag is set, the SB field s\_backup\_bgs |
| 597 | points to the two block groups that contain backup superblocks |
| 598 | (COMPAT\_SPARSE\_SUPER2). |
| 599 | |
| 600 | .. _super_incompat: |
| 601 | |
| 602 | The superblock incompatible features field is a combination of any of the |
| 603 | following: |
| 604 | |
| 605 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 606 | :widths: 16 64 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 607 | :header-rows: 1 |
| 608 | |
| 609 | * - Value |
| 610 | - Description |
| 611 | * - 0x1 |
| 612 | - Compression (INCOMPAT\_COMPRESSION). |
| 613 | * - 0x2 |
| 614 | - Directory entries record the file type. See ext4\_dir\_entry\_2 below |
| 615 | (INCOMPAT\_FILETYPE). |
| 616 | * - 0x4 |
| 617 | - Filesystem needs recovery (INCOMPAT\_RECOVER). |
| 618 | * - 0x8 |
| 619 | - Filesystem has a separate journal device (INCOMPAT\_JOURNAL\_DEV). |
| 620 | * - 0x10 |
| 621 | - Meta block groups. See the earlier discussion of this feature |
| 622 | (INCOMPAT\_META\_BG). |
| 623 | * - 0x40 |
| 624 | - Files in this filesystem use extents (INCOMPAT\_EXTENTS). |
| 625 | * - 0x80 |
| 626 | - Enable a filesystem size of 2^64 blocks (INCOMPAT\_64BIT). |
| 627 | * - 0x100 |
Ayush Ranjan | 219db95 | 2019-08-22 23:18:33 -0400 | [diff] [blame] | 628 | - Multiple mount protection (INCOMPAT\_MMP). |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 629 | * - 0x200 |
| 630 | - Flexible block groups. See the earlier discussion of this feature |
| 631 | (INCOMPAT\_FLEX\_BG). |
| 632 | * - 0x400 |
| 633 | - Inodes can be used to store large extended attribute values |
| 634 | (INCOMPAT\_EA\_INODE). |
| 635 | * - 0x1000 |
| 636 | - Data in directory entry (INCOMPAT\_DIRDATA). (Not implemented?) |
| 637 | * - 0x2000 |
| 638 | - Metadata checksum seed is stored in the superblock. This feature enables |
| 639 | the administrator to change the UUID of a metadata\_csum filesystem |
| 640 | while the filesystem is mounted; without it, the checksum definition |
| 641 | requires all metadata blocks to be rewritten (INCOMPAT\_CSUM\_SEED). |
| 642 | * - 0x4000 |
| 643 | - Large directory >2GB or 3-level htree (INCOMPAT\_LARGEDIR). Prior to |
| 644 | this feature, directories could not be larger than 4GiB and could not |
| 645 | have an htree more than 2 levels deep. If this feature is enabled, |
| 646 | directories can be larger than 4GiB and have a maximum htree depth of 3. |
| 647 | * - 0x8000 |
| 648 | - Data in inode (INCOMPAT\_INLINE\_DATA). |
| 649 | * - 0x10000 |
| 650 | - Encrypted inodes are present on the filesystem. (INCOMPAT\_ENCRYPT). |
| 651 | |
| 652 | .. _super_rocompat: |
| 653 | |
| 654 | The superblock read-only compatible features field is a combination of any of |
| 655 | the following: |
| 656 | |
| 657 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 658 | :widths: 16 64 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 659 | :header-rows: 1 |
| 660 | |
| 661 | * - Value |
| 662 | - Description |
| 663 | * - 0x1 |
| 664 | - Sparse superblocks. See the earlier discussion of this feature |
| 665 | (RO\_COMPAT\_SPARSE\_SUPER). |
| 666 | * - 0x2 |
| 667 | - This filesystem has been used to store a file greater than 2GiB |
| 668 | (RO\_COMPAT\_LARGE\_FILE). |
| 669 | * - 0x4 |
| 670 | - Not used in kernel or e2fsprogs (RO\_COMPAT\_BTREE\_DIR). |
| 671 | * - 0x8 |
| 672 | - This filesystem has files whose sizes are represented in units of |
| 673 | logical blocks, not 512-byte sectors. This implies a very large file |
| 674 | indeed! (RO\_COMPAT\_HUGE\_FILE) |
| 675 | * - 0x10 |
| 676 | - Group descriptors have checksums. In addition to detecting corruption, |
| 677 | this is useful for lazy formatting with uninitialized groups |
| 678 | (RO\_COMPAT\_GDT\_CSUM). |
| 679 | * - 0x20 |
| 680 | - Indicates that the old ext3 32,000 subdirectory limit no longer applies |
| 681 | (RO\_COMPAT\_DIR\_NLINK). A directory's i\_links\_count will be set to 1 |
| 682 | if it is incremented past 64,999. |
| 683 | * - 0x40 |
| 684 | - Indicates that large inodes exist on this filesystem |
| 685 | (RO\_COMPAT\_EXTRA\_ISIZE). |
| 686 | * - 0x80 |
| 687 | - This filesystem has a snapshot (RO\_COMPAT\_HAS\_SNAPSHOT). |
| 688 | * - 0x100 |
| 689 | - `Quota <Quota>`__ (RO\_COMPAT\_QUOTA). |
| 690 | * - 0x200 |
| 691 | - This filesystem supports “bigalloc”, which means that file extents are |
| 692 | tracked in units of clusters (of blocks) instead of blocks |
| 693 | (RO\_COMPAT\_BIGALLOC). |
| 694 | * - 0x400 |
| 695 | - This filesystem supports metadata checksumming. |
| 696 | (RO\_COMPAT\_METADATA\_CSUM; implies RO\_COMPAT\_GDT\_CSUM, though |
| 697 | GDT\_CSUM must not be set) |
| 698 | * - 0x800 |
| 699 | - Filesystem supports replicas. This feature is neither in the kernel nor |
| 700 | e2fsprogs. (RO\_COMPAT\_REPLICA) |
| 701 | * - 0x1000 |
| 702 | - Read-only filesystem image; the kernel will not mount this image |
| 703 | read-write and most tools will refuse to write to the image. |
| 704 | (RO\_COMPAT\_READONLY) |
| 705 | * - 0x2000 |
| 706 | - Filesystem tracks project quotas. (RO\_COMPAT\_PROJECT) |
Eric Biggers | 84fb7ca | 2019-07-22 09:26:24 -0700 | [diff] [blame] | 707 | * - 0x8000 |
| 708 | - Verity inodes may be present on the filesystem. (RO\_COMPAT\_VERITY) |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 709 | |
| 710 | .. _super_def_hash: |
| 711 | |
| 712 | The ``s_def_hash_version`` field is one of the following: |
| 713 | |
| 714 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 715 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 716 | :header-rows: 1 |
| 717 | |
| 718 | * - Value |
| 719 | - Description |
| 720 | * - 0x0 |
| 721 | - Legacy. |
| 722 | * - 0x1 |
| 723 | - Half MD4. |
| 724 | * - 0x2 |
| 725 | - Tea. |
| 726 | * - 0x3 |
| 727 | - Legacy, unsigned. |
| 728 | * - 0x4 |
| 729 | - Half MD4, unsigned. |
| 730 | * - 0x5 |
| 731 | - Tea, unsigned. |
| 732 | |
| 733 | .. _super_mountopts: |
| 734 | |
| 735 | The ``s_default_mount_opts`` field is any combination of the following: |
| 736 | |
| 737 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 738 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 739 | :header-rows: 1 |
| 740 | |
| 741 | * - Value |
| 742 | - Description |
| 743 | * - 0x0001 |
| 744 | - Print debugging info upon (re)mount. (EXT4\_DEFM\_DEBUG) |
| 745 | * - 0x0002 |
| 746 | - New files take the gid of the containing directory (instead of the fsgid |
| 747 | of the current process). (EXT4\_DEFM\_BSDGROUPS) |
| 748 | * - 0x0004 |
| 749 | - Support userspace-provided extended attributes. (EXT4\_DEFM\_XATTR\_USER) |
| 750 | * - 0x0008 |
| 751 | - Support POSIX access control lists (ACLs). (EXT4\_DEFM\_ACL) |
| 752 | * - 0x0010 |
| 753 | - Do not support 32-bit UIDs. (EXT4\_DEFM\_UID16) |
| 754 | * - 0x0020 |
| 755 | - All data and metadata are commited to the journal. |
| 756 | (EXT4\_DEFM\_JMODE\_DATA) |
| 757 | * - 0x0040 |
| 758 | - All data are flushed to the disk before metadata are committed to the |
| 759 | journal. (EXT4\_DEFM\_JMODE\_ORDERED) |
| 760 | * - 0x0060 |
| 761 | - Data ordering is not preserved; data may be written after the metadata |
| 762 | has been written. (EXT4\_DEFM\_JMODE\_WBACK) |
| 763 | * - 0x0100 |
| 764 | - Disable write flushes. (EXT4\_DEFM\_NOBARRIER) |
| 765 | * - 0x0200 |
| 766 | - Track which blocks in a filesystem are metadata and therefore should not |
| 767 | be used as data blocks. This option will be enabled by default on 3.18, |
| 768 | hopefully. (EXT4\_DEFM\_BLOCK\_VALIDITY) |
| 769 | * - 0x0400 |
| 770 | - Enable DISCARD support, where the storage device is told about blocks |
| 771 | becoming unused. (EXT4\_DEFM\_DISCARD) |
| 772 | * - 0x0800 |
| 773 | - Disable delayed allocation. (EXT4\_DEFM\_NODELALLOC) |
| 774 | |
| 775 | .. _super_flags: |
| 776 | |
| 777 | The ``s_flags`` field is any combination of the following: |
| 778 | |
| 779 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 780 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 781 | :header-rows: 1 |
| 782 | |
| 783 | * - Value |
| 784 | - Description |
| 785 | * - 0x0001 |
| 786 | - Signed directory hash in use. |
| 787 | * - 0x0002 |
| 788 | - Unsigned directory hash in use. |
| 789 | * - 0x0004 |
| 790 | - To test development code. |
| 791 | |
| 792 | .. _super_encrypt: |
| 793 | |
| 794 | The ``s_encrypt_algos`` list can contain any of the following: |
| 795 | |
| 796 | .. list-table:: |
Darrick J. Wong | de7abd7 | 2018-10-02 22:43:40 -0400 | [diff] [blame] | 797 | :widths: 8 72 |
Darrick J. Wong | 3db42a2 | 2018-07-29 15:39:00 -0400 | [diff] [blame] | 798 | :header-rows: 1 |
| 799 | |
| 800 | * - Value |
| 801 | - Description |
| 802 | * - 0 |
| 803 | - Invalid algorithm (ENCRYPTION\_MODE\_INVALID). |
| 804 | * - 1 |
| 805 | - 256-bit AES in XTS mode (ENCRYPTION\_MODE\_AES\_256\_XTS). |
| 806 | * - 2 |
| 807 | - 256-bit AES in GCM mode (ENCRYPTION\_MODE\_AES\_256\_GCM). |
| 808 | * - 3 |
| 809 | - 256-bit AES in CBC mode (ENCRYPTION\_MODE\_AES\_256\_CBC). |
| 810 | |
| 811 | Total size of the superblock is 1024 bytes. |