1 .. SPDX-License-Identifier: GPL-2.0
6 The superblock records various information about the enclosing
7 filesystem, such as block counts, inode counts, supported features,
8 maintenance information, and more.
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.
15 The superblock checksum is calculated against the superblock structure,
16 which includes the FS UUID.
18 The ext4 superblock is laid out as follows in
19 ``struct ext4_super_block``:
40 - This number of blocks can only be allocated by the super-user.
43 - s_free_blocks_count_lo
52 - First data block. This must be at least 1 for 1k-block filesystems and
53 is typically 0 for all other block sizes.
57 - Block size is 2 ^ (10 + s_log_block_size).
61 - Cluster size is 2 ^ (10 + s_log_cluster_size) blocks if bigalloc is
62 enabled. Otherwise s_log_cluster_size must equal s_log_block_size.
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.
79 - Mount time, in seconds since the epoch.
83 - Write time, in seconds since the epoch.
87 - Number of mounts since the last fsck.
91 - Number of mounts beyond which a fsck is needed.
95 - Magic signature, 0xEF53
99 - File system state. See super_state_ for more info.
103 - Behaviour when detecting errors. See super_errors_ for more info.
107 - Minor revision level.
111 - Time of last check, in seconds since the epoch.
115 - Maximum time between checks, in seconds.
119 - Creator OS. See the table super_creator_ for more info.
123 - Revision level. See the table super_revision_ for more info.
127 - Default uid for reserved blocks.
131 - Default gid for reserved blocks.
135 - These fields are for EXT4_DYNAMIC_REV superblocks only.
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.
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...
148 - First non-reserved inode.
152 - Size of inode structure, in bytes.
156 - Block group # of this superblock.
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.
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
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
178 - 128-bit UUID for volume.
186 - Directory where filesystem was last mounted.
189 - s_algorithm_usage_bitmap
190 - For compression (Not used in e2fsprogs/Linux)
194 - Performance hints. Directory preallocation should only happen if the
195 EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
199 - #. of blocks to try to preallocate for ... files? (Not used in
203 - s_prealloc_dir_blocks
204 - #. of blocks to preallocate for directories. (Not used in
208 - s_reserved_gdt_blocks
209 - Number of reserved GDT entries for future filesystem expansion.
213 - Journalling support is valid only if EXT4_FEATURE_COMPAT_HAS_JOURNAL is
218 - UUID of journal superblock
222 - inode number of journal file.
226 - Device number of journal file, if the external journal feature flag is
231 - Start of list of orphaned inodes to delete.
239 - Default hash algorithm to use for directory hashes. See super_def_hash_
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``.
250 - Size of group descriptors, in bytes, if the 64bit incompat feature flag
254 - s_default_mount_opts
255 - Default mount options. See the super_mountopts_ table for more info.
259 - First metablock block group, if the meta_bg feature is enabled.
263 - When the filesystem was created, in seconds since the epoch.
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,
273 - 64bit support is valid only if EXT4_FEATURE_COMPAT_64BIT is set.
277 - High 32-bits of the block count.
280 - s_r_blocks_count_hi
281 - High 32-bits of the reserved block count.
284 - s_free_blocks_count_hi
285 - High 32-bits of the free block count.
289 - All inodes have at least # bytes.
293 - New inodes should reserve # bytes.
297 - Miscellaneous flags. See the super_flags_ table for more info.
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.
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...
314 - Block # for multi-mount protection data.
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.
324 - s_log_groups_per_flex
325 - Size of a flexible block group is 2 ^ ``s_log_groups_per_flex``.
329 - Metadata checksum algorithm type. The only valid value is 1 (crc32c).
337 - Number of KiB written to this filesystem over its lifetime.
341 - inode number of active snapshot. (Not used in e2fsprogs/Linux.)
345 - Sequential ID of active snapshot. (Not used in e2fsprogs/Linux.)
348 - s_snapshot_r_blocks_count
349 - Number of blocks reserved for active snapshot's future use. (Not used in
354 - inode number of the head of the on-disk snapshot list. (Not used in
359 - Number of errors seen.
363 - First time an error happened, in seconds since the epoch.
367 - inode involved in first error.
370 - s_first_error_block
371 - Number of block involved of first error.
374 - s_first_error_func[32]
375 - Name of function where the error happened.
379 - Line number where error happened.
383 - Time of most recent error, in seconds since the epoch.
387 - inode involved in most recent error.
391 - Line number where most recent error happened.
395 - Number of block involved in most recent error.
398 - s_last_error_func[32]
399 - Name of function where the most recent error happened.
403 - ASCIIZ string of mount options.
407 - Inode number of user `quota <quota>`__ file.
411 - Inode number of group `quota <quota>`__ file.
415 - Overhead blocks/clusters in fs. (Huh? This field is always zero, which
416 means that the kernel calculates it dynamically.)
420 - Block groups containing superblock backups (if sparse_super2)
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
429 - s_encrypt_pw_salt[16]
430 - Salt for the string2key algorithm for encryption.
434 - Inode number of lost+found
438 - Inode that tracks project quotas.
442 - Checksum seed used for metadata_csum calculations. This value is
443 crc32c(~0, $orig_fs_uuid).
447 - Upper 8 bits of the s_wtime field.
451 - Upper 8 bits of the s_mtime field.
455 - Upper 8 bits of the s_mkfs_time field.
459 - Upper 8 bits of the s_lastcheck field.
462 - s_first_error_time_hi
463 - Upper 8 bits of the s_first_error_time field.
466 - s_last_error_time_hi
467 - Upper 8 bits of the s_last_error_time field.
475 - Filename charset encoding.
479 - Filename charset encoding flags.
483 - Orphan file inode number.
487 - Padding to the end of the block.
491 - Superblock checksum.
495 The superblock state is some combination of the following:
508 - Orphans being recovered
512 The superblock error policy is one of the following:
529 The filesystem creator is one of the following:
550 The superblock revision is one of the following:
561 - v2 format w/ dynamic inode sizes
563 Note that ``EXT4_DYNAMIC_REV`` refers to a revision 1 or newer filesystem.
567 The superblock compatible features field is a combination of any of the
577 - Directory preallocation (COMPAT_DIR_PREALLOC).
579 - “imagic inodes”. Not clear from the code what this does
580 (COMPAT_IMAGIC_INODES).
582 - Has a journal (COMPAT_HAS_JOURNAL).
584 - Supports extended attributes (COMPAT_EXT_ATTR).
586 - Has reserved GDT blocks for filesystem expansion
587 (COMPAT_RESIZE_INODE). Requires RO_COMPAT_SPARSE_SUPER.
589 - Has directory indices (COMPAT_DIR_INDEX).
591 - “Lazy BG”. Not in Linux kernel, seems to have been for uninitialized
592 block groups? (COMPAT_LAZY_BG)
594 - “Exclude inode”. Not used. (COMPAT_EXCLUDE_INODE).
596 - “Exclude bitmap”. Seems to be used to indicate the presence of
597 snapshot-related exclude bitmaps? Not defined in kernel or used in
598 e2fsprogs (COMPAT_EXCLUDE_BITMAP).
600 - Sparse Super Block, v2. If this flag is set, the SB field s_backup_bgs
601 points to the two block groups that contain backup superblocks
602 (COMPAT_SPARSE_SUPER2).
604 - Fast commits supported. Although fast commits blocks are
605 backward incompatible, fast commit blocks are not always
606 present in the journal. If fast commit blocks are present in
607 the journal, JBD2 incompat feature
608 (JBD2_FEATURE_INCOMPAT_FAST_COMMIT) gets
609 set (COMPAT_FAST_COMMIT).
611 - Orphan file allocated. This is the special file for more efficient
612 tracking of unlinked but still open inodes. When there may be any
613 entries in the file, we additionally set proper rocompat feature
614 (RO_COMPAT_ORPHAN_PRESENT).
618 The superblock incompatible features field is a combination of any of the
628 - Compression (INCOMPAT_COMPRESSION).
630 - Directory entries record the file type. See ext4_dir_entry_2 below
633 - Filesystem needs recovery (INCOMPAT_RECOVER).
635 - Filesystem has a separate journal device (INCOMPAT_JOURNAL_DEV).
637 - Meta block groups. See the earlier discussion of this feature
640 - Files in this filesystem use extents (INCOMPAT_EXTENTS).
642 - Enable a filesystem size of 2^64 blocks (INCOMPAT_64BIT).
644 - Multiple mount protection (INCOMPAT_MMP).
646 - Flexible block groups. See the earlier discussion of this feature
649 - Inodes can be used to store large extended attribute values
652 - Data in directory entry (INCOMPAT_DIRDATA). (Not implemented?)
654 - Metadata checksum seed is stored in the superblock. This feature enables
655 the administrator to change the UUID of a metadata_csum filesystem
656 while the filesystem is mounted; without it, the checksum definition
657 requires all metadata blocks to be rewritten (INCOMPAT_CSUM_SEED).
659 - Large directory >2GB or 3-level htree (INCOMPAT_LARGEDIR). Prior to
660 this feature, directories could not be larger than 4GiB and could not
661 have an htree more than 2 levels deep. If this feature is enabled,
662 directories can be larger than 4GiB and have a maximum htree depth of 3.
664 - Data in inode (INCOMPAT_INLINE_DATA).
666 - Encrypted inodes are present on the filesystem. (INCOMPAT_ENCRYPT).
670 The superblock read-only compatible features field is a combination of any of
680 - Sparse superblocks. See the earlier discussion of this feature
681 (RO_COMPAT_SPARSE_SUPER).
683 - This filesystem has been used to store a file greater than 2GiB
684 (RO_COMPAT_LARGE_FILE).
686 - Not used in kernel or e2fsprogs (RO_COMPAT_BTREE_DIR).
688 - This filesystem has files whose sizes are represented in units of
689 logical blocks, not 512-byte sectors. This implies a very large file
690 indeed! (RO_COMPAT_HUGE_FILE)
692 - Group descriptors have checksums. In addition to detecting corruption,
693 this is useful for lazy formatting with uninitialized groups
694 (RO_COMPAT_GDT_CSUM).
696 - Indicates that the old ext3 32,000 subdirectory limit no longer applies
697 (RO_COMPAT_DIR_NLINK). A directory's i_links_count will be set to 1
698 if it is incremented past 64,999.
700 - Indicates that large inodes exist on this filesystem
701 (RO_COMPAT_EXTRA_ISIZE).
703 - This filesystem has a snapshot (RO_COMPAT_HAS_SNAPSHOT).
705 - `Quota <Quota>`__ (RO_COMPAT_QUOTA).
707 - This filesystem supports “bigalloc”, which means that file extents are
708 tracked in units of clusters (of blocks) instead of blocks
709 (RO_COMPAT_BIGALLOC).
711 - This filesystem supports metadata checksumming.
712 (RO_COMPAT_METADATA_CSUM; implies RO_COMPAT_GDT_CSUM, though
713 GDT_CSUM must not be set)
715 - Filesystem supports replicas. This feature is neither in the kernel nor
716 e2fsprogs. (RO_COMPAT_REPLICA)
718 - Read-only filesystem image; the kernel will not mount this image
719 read-write and most tools will refuse to write to the image.
722 - Filesystem tracks project quotas. (RO_COMPAT_PROJECT)
724 - Verity inodes may be present on the filesystem. (RO_COMPAT_VERITY)
726 - Indicates orphan file may have valid orphan entries and thus we need
727 to clean them up when mounting the filesystem
728 (RO_COMPAT_ORPHAN_PRESENT).
732 The ``s_def_hash_version`` field is one of the following:
749 - Half MD4, unsigned.
755 The ``s_default_mount_opts`` field is any combination of the following:
764 - Print debugging info upon (re)mount. (EXT4_DEFM_DEBUG)
766 - New files take the gid of the containing directory (instead of the fsgid
767 of the current process). (EXT4_DEFM_BSDGROUPS)
769 - Support userspace-provided extended attributes. (EXT4_DEFM_XATTR_USER)
771 - Support POSIX access control lists (ACLs). (EXT4_DEFM_ACL)
773 - Do not support 32-bit UIDs. (EXT4_DEFM_UID16)
775 - All data and metadata are committed to the journal.
776 (EXT4_DEFM_JMODE_DATA)
778 - All data are flushed to the disk before metadata are committed to the
779 journal. (EXT4_DEFM_JMODE_ORDERED)
781 - Data ordering is not preserved; data may be written after the metadata
782 has been written. (EXT4_DEFM_JMODE_WBACK)
784 - Disable write flushes. (EXT4_DEFM_NOBARRIER)
786 - Track which blocks in a filesystem are metadata and therefore should not
787 be used as data blocks. This option will be enabled by default on 3.18,
788 hopefully. (EXT4_DEFM_BLOCK_VALIDITY)
790 - Enable DISCARD support, where the storage device is told about blocks
791 becoming unused. (EXT4_DEFM_DISCARD)
793 - Disable delayed allocation. (EXT4_DEFM_NODELALLOC)
797 The ``s_flags`` field is any combination of the following:
806 - Signed directory hash in use.
808 - Unsigned directory hash in use.
810 - To test development code.
814 The ``s_encrypt_algos`` list can contain any of the following:
823 - Invalid algorithm (ENCRYPTION_MODE_INVALID).
825 - 256-bit AES in XTS mode (ENCRYPTION_MODE_AES_256_XTS).
827 - 256-bit AES in GCM mode (ENCRYPTION_MODE_AES_256_GCM).
829 - 256-bit AES in CBC mode (ENCRYPTION_MODE_AES_256_CBC).
831 Total size of the superblock is 1024 bytes.