Ext4: Difference between revisions

Jump to navigation Jump to search
9,073 bytes added ,  3 years ago
Add superblock structure.
[unchecked revision][unchecked revision]
m (add link to German wiki)
(Add superblock structure.)
Line 2:
{{Filesystems}}
While the ext4 filesystem originated a series of patches to the [[ext3]] filesystem, it was later rebranded as a dedicated filesystem design that shares design with [[ext2]] and [[ext3]]. Like ext3, it supports [[journaling]]. Amongst the upgrades are larger maximums (file size, filesystem size, files per folder, folders per folder etc), and features that were inspired from existing filesystems like [[XFS]].
== Superblock ==
 
See [[Ext2#Superblock|Ext2]] wiki page for an easier introduction to the concept of a superblock. All values are little endian unless otherwise specified.
 
{| {{wikitable}}
! Starting
Byte
! Ending
Byte
! Size
! Description
|-
| 0 || 3 || 4 || Total number of inodes in file system
|-
| 4 || 7 || 4 || Total number of blocks in file system
|-
| 8 || 11 || 4 || Number of reserved blocks
|-
| 12 || 15 || 4 || Total number of unallocated blocks
|-
| 16 || 19 || 4 || Total number of unallocated inodes
|-
| 20 || 23 || 4 || Block number of the block containing the superblock. This is 1 on 1024 byte block size filesystems, and 0 for all others.
|-
| 24 || 27 || 4 || ''log''<sub>2</sub> (block size) - 10. (In other words, the number to shift 1,024 to the left by to obtain the block size)
|-
| 28 || 31 || 4 || ''log''<sub>2</sub> (fragment size) - 10. (In other words, the number to shift 1,024 to the left by to obtain the fragment size)
|-
| 32 || 35 || 4 || Number of blocks in each block group
|-
| 36 || 39 || 4 || Number of fragments in each block group
|-
| 40 || 43 || 4 || Number of inodes in each block group
|-
| 44 || 47 || 4 || Last mount time (in [http://en.wikipedia.org/wiki/Unix_time POSIX time])
|-
| 48 || 51 || 4 || Last written time (in [http://en.wikipedia.org/wiki/Unix_time POSIX time])
|-
| 52 || 53 || 2 || Number of times the volume has been mounted since its last consistency check ([http://en.wikipedia.org/wiki/Fsck fsck])
|-
| 54 || 55 || 2 || Number of mounts allowed before a consistency check ([http://en.wikipedia.org/wiki/Fsck fsck]) must be done
|-
| 56 || 57 || 2 || Magic signature (0xef53), used to help confirm the presence of Ext4 on a volume
|-
| 58 || 59 || 2 || File system state.
|-
| 60 || 61 || 2 || What to do when an error is detected
|-
| 62 || 63 || 2 || Minor portion of version (combine with Major portion below to construct full version field)
|-
| 64 || 67 || 4 || [http://en.wikipedia.org/wiki/Unix_time POSIX time] of last consistency check ([http://en.wikipedia.org/wiki/Fsck fsck])
|-
| 68 || 71 || 4 || Interval (in [http://en.wikipedia.org/wiki/Unix_time POSIX time]) between forced consistency checks ([http://en.wikipedia.org/wiki/Fsck fsck])
|-
| 72 || 75 || 4 || Operating system ID from which the filesystem on this volume was created ([[#Creator_Operating_System_IDs|see below]])
|-
| 76 || 79 || 4 || Major portion of version (combine with Minor portion above to construct full version field)
|-
| 80 || 81 || 2 || User ID that can use reserved blocks
|-
| 82 || 83 || 2 || Group ID that can use reserved blocks
|}
 
These fields are for ext4 dynamic superblocks only. If a bit is set in the required feature set it does not recognize, it '''must''' refuse to mount the filesystem. Filesystem checks, however, must abort on any unrecognized flag in the optional or required features.
 
{| {{wikitable}}
!Starting
Byte
!Ending
Byte
!Size
in Bytes
!Description
|-
| 84 || 87 || 4 || First non-reserved inode in file system.
|-
| 88 || 89 || 2 || Size of each inode structure in bytes.
|-
| 90 || 91 || 2 || Block group that this superblock is part of for backup copies.
|-
| 92 || 95 || 4 || Optional features present.
|-
| 96 || 99 || 4 || Required features present.
|-
| 100 || 103 || 4 || Features that if not supported the volume must be mounted read-only.
|-
| 104 || 119 || 16 || File system UUID.
|-
| 120 || 135 || 16 || Volume name.
|-
| 136 || 199 || 64 || Path Volume was last mounted to.
|-
| 200 || 203 || 4 || Compression algorithm used.
|-
| 204 || 204 || 1 || Amount of blocks to preallocate for files
|-
| 205 || 205 || 1 || Amount of blocks to preallocate for directories.
|-
| 206 || 207 || 2 || Amount of reserved GDT entries for filesystem expansion.
|-
| 208 || 223 || 16 || Journal UUID.
|-
| 224 || 227 || 4 || Journal Inode.
|-
| 228 || 231 || 4 || Journal Device number.
|-
| 232 || 235 || 4 || Head of orphan inode list.
|-
| 236 || 251 || 16 || HTREE hash seed in an array of 32 bit integers.
|-
| 252 || 252 || 1 || Hash algorithm to use for directories.
|-
| 253 || 253 || 1 || Journal blocks field contains a copy of the inode's block array and size.
|-
| 254 || 255 || 2 || Size of group descriptors in bytes, for 64 bit mode.
|-
| 256 || 259 || 4 || Mount options.
|-
| 260 || 263 || 4 || First metablock block group, if enabled.
|-
| 264 || 267 || 4 || Filesystem Creation Time.
|-
| 268 || 335 || 68 || Journal Inode Backup in an array of 32 bit integers.
|}
 
Valid if the 64bit feature is set.
 
{| {{wikitable}}
!Starting
Byte
!Ending
Byte
!Size
in Bytes
!Description
|-
| 336 || 339 || 4 || High 32-bits of the total number of blocks.
|-
| 340 || 343 || 4 || High 32-bits of the total number of reserved blocks.
|-
| 344 || 347 || 4 || High 32-bits of the total number of unallocated blocks.
|-
| 348 || 349 || 2 || Minimum inode size.
|-
| 350 || 351 || 2 || Minimum inode reservation size.
|-
| 352 || 355 || 4 || Misc flags, such as sign of directory hash or development status.
|-
| 356 || 357 || 2 || Amount logical blocks read or written per disk in a RAID array.
|-
| 358 || 359 || 2 || Amount of seconds to wait in Multi-mount prevention checking.
|-
| 360 || 367 || 8 || Block to multi-mount prevent.
|-
| 368 || 371 || 4 || Amount of blocks to read or write before returning to the current disk in a RAID array. Amount of disks * stride.
|-
| 372 || 372 || 1 || ''log''<sub>2</sub> (groups per flex) - 10. (In other words, the number to shift 1,024 to the left by to obtain the groups per flex block group)
|-
| 373 || 373 || 1 || Metadata checksum algorithm used. Linux only supports crc32.
|-
| 374 || 374 || 1 || Encryption version level.
|-
| 375 || 375 || 1 || Reserved padding.
|-
| 376 || 383 || 8 || Amount of kilobytes written over the filesystem's lifetime.
|-
| 384 || 387 || 4 || Inode number of the active snapshot.
|-
| 388 || 391 || 4 || Sequential ID of active snapshot.
|-
| 392 || 399 || 8 || Number of blocks reserved for active snapshot.
|-
| 400 || 403 || 4 || Inode number of the head of the disk snapshot list.
|-
| 404 || 407 || 4 || Amount of errors detected.
|-
| 408 || 411 || 4 || First time an error occurred in POSIX time.
|-
| 412 || 415 || 4 || Inode number in the first error.
|-
| 416 || 423 || 8 || Block number in the first error.
|-
| 424 || 455 || 32 || Function where the first error occurred.
|-
| 456 || 459 || 4 || Line number where the first error occurred.
|-
| 460 || 463 || 4 || Most recent time an error occurred in POSIX time.
|-
| 464 || 467 || 4 || Inode number in the last error.
|-
| 468 || 475 || 8 || Block number in the last error.
|-
| 476 || 507 || 32 || Function where the most recent error occurred.
|-
| 508 || 511 || 4 || Line number where the most recent error occurred.
|-
| 512 || 575 || 64 || Mount options. (C-style string: characters terminated by a 0 byte)
|-
| 576 || 579 || 4 || Inode number for user quota file.
|-
| 580 || 583 || 4 || Inode number for group quota file.
|-
| 584 || 587 || 4 || Overhead blocks/clusters in filesystem. Zero means the kernel calculates it at runtime.
|-
| 588 || 595 || 8 || Block groups with backup Superblocks, if the sparse superblock flag is set.
|-
| 596 || 599 || 4 || Encryption algorithms used, as a array of unsigned char.
|-
| 600 || 615 || 16 || Salt for the `string2key` algorithm.
|-
| 616 || 619 || 4 || Inode number of the lost+found directory.
|-
| 620 || 623 || 4 || Inode number of the project quota tracker.
|-
| 624 || 627 || 4 || Checksum of the UUID, used for the checksum seed. (crc32c(~0, UUID))
|-
| 628 || 628 || 1 || High 8-bits of the last written time field.
|-
| 629 || 629 || 1 || High 8-bits of the last mount time field.
|-
| 630 || 630 || 1 || High 8-bits of the Filesystem creation time field.
|-
| 631 || 631 || 1 || High 8-bits of the last consistency check time field.
|-
| 632 || 632 || 1 || High 8-bits of the first time an error occurred time field.
|-
| 633 || 633 || 1 || High 8-bits of the latest time an error occurred time field.
|-
| 634 || 634 || 1 || Error code of the first error.
|-
| 635 || 635 || 1 || Error code of the latest error.
|-
| 636 || 637 || 2 || Filename charset encoding.
|-
| 638 || 639 || 2 || Filename charset encoding flags.
|-
| 640 || 1019 || 380 || Padding.
|-
| 1020 || 1023 || 4 || Checksum of the superblock.
|}
 
Optional Features:
 
{| {{wikitable}}
! Flag
Value
! Description
|-
| 0x0001 || Preallocate some number of blocks (see byte 205 in the superblock) to a directory when creating a new one.
|-
| 0x0002 || Possibly unused, "imagic inodes"
|-
| 0x0004 || Filesystem uses a Journal
|-
| 0x0008 || Inodes have Extended Attributes.
|-
| 0x0010 || Filesystem can resize itself for larger partitions.
|-
| 0x0020 || Directories use hash index.
|-
| 0x0200 || Backup the superblock in other block groups.
|-
| 0x0800 || Unclear, seems to be used in fs encryption, "stable inodes"
|}
 
==See Also==
===External Links===
* [https://github.com/torvalds/linux/blob/master/fs/ext4/ext4.h Linux ext4 header] - This header contains useful definitions and declarations.
 
[[de:Ext4]]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu