EXT4 超级块介绍(转)
https://blog.csdn.net/sunlei0625/article/details/79011946
The superblock records various information about the enclosing filesystem, such as block counts, inode counts, supported features, maintenance information, and more.
If the sparse_super feature flag is set, redundant copies of the superblock and group descriptors are kept only in the groups whose group number is either 0 or a power of 3, 5, or 7. If the flag is not set, redundant copies are kept in all groups.
The superblock checksum is calculated against the superblock structure, which includes the FS UUID.
The ext4 superblock is laid out as follows in struct ext4_super_block:
| Offset | Size | Name | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0x0 | __le32 | s_inodes_count | Total inode count. | ||||||||||||||||||||||||||||||
| 0x4 | __le32 | s_blocks_count_lo | Total block count. | ||||||||||||||||||||||||||||||
| 0x8 | __le32 | s_r_blocks_count_lo | This number of blocks can only be allocated by the super-user. | ||||||||||||||||||||||||||||||
| 0xC | __le32 | s_free_blocks_count_lo | Free block count. | ||||||||||||||||||||||||||||||
| 0x10 | __le32 | s_free_inodes_count | Free inode count. | ||||||||||||||||||||||||||||||
| 0x14 | __le32 | s_first_data_block | First data block. This must be at least 1 for 1k-block filesystems and is typically 0 for all other block sizes. | ||||||||||||||||||||||||||||||
| 0x18 | __le32 | s_log_block_size | Block size is 2 ^ (10 + s_log_block_size). | ||||||||||||||||||||||||||||||
| 0x1C | __le32 | s_log_cluster_size | Cluster size is (2 ^ s_log_cluster_size) blocks if bigalloc is enabled, zero otherwise. | ||||||||||||||||||||||||||||||
| 0x20 | __le32 | s_blocks_per_group | Blocks per group. | ||||||||||||||||||||||||||||||
| 0x24 | __le32 | s_clusters_per_group | Clusters per group, if bigalloc is enabled. | ||||||||||||||||||||||||||||||
| 0x28 | __le32 | s_inodes_per_group | Inodes per group. | ||||||||||||||||||||||||||||||
| 0x2C | __le32 | s_mtime | Mount time, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x30 | __le32 | s_wtime | Write time, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x34 | __le16 | s_mnt_count | Number of mounts since the last fsck. | ||||||||||||||||||||||||||||||
| 0x36 | __le16 | s_max_mnt_count | Number of mounts beyond which a fsck is needed. | ||||||||||||||||||||||||||||||
| 0x38 | __le16 | s_magic | Magic signature, 0xEF53 | ||||||||||||||||||||||||||||||
| 0x3A | __le16 | s_state | File system state. Valid values are:
|
||||||||||||||||||||||||||||||
| 0x3C | __le16 | s_errors | Behaviour when detecting errors. One of:
|
||||||||||||||||||||||||||||||
| 0x3E | __le16 | s_minor_rev_level | Minor revision level. | ||||||||||||||||||||||||||||||
| 0x40 | __le32 | s_lastcheck | Time of last check, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x44 | __le32 | s_checkinterval | Maximum time between checks, in seconds. | ||||||||||||||||||||||||||||||
| 0x48 | __le32 | s_creator_os | OS. One of:
|
||||||||||||||||||||||||||||||
| 0x4C | __le32 | s_rev_level | Revision level. One of:
|
||||||||||||||||||||||||||||||
| 0x50 | __le16 | s_def_resuid | Default uid for reserved blocks. | ||||||||||||||||||||||||||||||
| 0x52 | __le16 | s_def_resgid | Default gid for reserved blocks. | ||||||||||||||||||||||||||||||
| These fields are for EXT4_DYNAMIC_REV superblocks only.
Note: the difference between the compatible feature set and the incompatible feature set is that if there is a bit set in the incompatible feature set that the kernel doesn't know about, it should refuse to mount the filesystem. e2fsck's requirements are more strict; if it doesn't know about a feature in either the compatible or incompatible feature set, it must abort and not try to meddle with things it doesn't understand... |
|||||||||||||||||||||||||||||||||
| 0x54 | __le32 | s_first_ino | First non-reserved inode. | ||||||||||||||||||||||||||||||
| 0x58 | __le16 | s_inode_size | Size of inode structure, in bytes. | ||||||||||||||||||||||||||||||
| 0x5A | __le16 | s_block_group_nr | Block group # of this superblock. | ||||||||||||||||||||||||||||||
| 0x5C | __le32 | s_feature_compat | Compatible feature set flags. Kernel can still read/write this fs even if it doesn't understand a flag; fsck should not do that. Any of:
|
||||||||||||||||||||||||||||||
| 0x60 | __le32 | s_feature_incompat | Incompatible feature set. If the kernel or fsck doesn't understand one of these bits, it should stop. Any of:
|
||||||||||||||||||||||||||||||
| 0x64 | __le32 | s_feature_ro_compat | Readonly-compatible feature set. If the kernel doesn't understand one of these bits, it can still mount read-only. Any of:
|
||||||||||||||||||||||||||||||
| 0x68 | __u8 | s_uuid[16] | 128-bit UUID for volume. | ||||||||||||||||||||||||||||||
| 0x78 | char | s_volume_name[16] | Volume label. | ||||||||||||||||||||||||||||||
| 0x88 | char | s_last_mounted[64] | Directory where filesystem was last mounted. | ||||||||||||||||||||||||||||||
| 0xC8 | __le32 | s_algorithm_usage_bitmap | For compression (Not used in e2fsprogs/Linux) | ||||||||||||||||||||||||||||||
| Performance hints. Directory preallocation should only happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on. | |||||||||||||||||||||||||||||||||
| 0xCC | __u8 | s_prealloc_blocks | # of blocks to try to preallocate for ... files? (Not used in e2fsprogs/Linux) | ||||||||||||||||||||||||||||||
| 0xCD | __u8 | s_prealloc_dir_blocks | # of blocks to preallocate for directories. (Not used in e2fsprogs/Linux) | ||||||||||||||||||||||||||||||
| 0xCE | __le16 | s_reserved_gdt_blocks | Number of reserved GDT entries for future filesystem expansion. | ||||||||||||||||||||||||||||||
| Journaling support valid if EXT4_FEATURE_COMPAT_HAS_JOURNAL set. | |||||||||||||||||||||||||||||||||
| 0xD0 | __u8 | s_journal_uuid[16] | UUID of journal superblock | ||||||||||||||||||||||||||||||
| 0xE0 | __le32 | s_journal_inum | inode number of journal file. | ||||||||||||||||||||||||||||||
| 0xE4 | __le32 | s_journal_dev | Device number of journal file, if the external journal feature flag is set. | ||||||||||||||||||||||||||||||
| 0xE8 | __le32 | s_last_orphan | Start of list of orphaned inodes to delete. | ||||||||||||||||||||||||||||||
| 0xEC | __le32 | s_hash_seed[4] | HTREE hash seed. | ||||||||||||||||||||||||||||||
| 0xFC | __u8 | s_def_hash_version | Default hash algorithm to use for directory hashes. One of:
|
||||||||||||||||||||||||||||||
| 0xFD | __u8 | s_jnl_backup_type | If this value is 0 or EXT3_JNL_BACKUP_BLOCKS (1), then the s_jnl_blocks field contains a duplicate copy of the inode's i_block[] array and i_size. |
||||||||||||||||||||||||||||||
| 0xFE | __le16 | s_desc_size | Size of group descriptors, in bytes, if the 64bit incompat feature flag is set. | ||||||||||||||||||||||||||||||
| 0x100 | __le32 | s_default_mount_opts | Default mount options. Any of:
|
||||||||||||||||||||||||||||||
| 0x104 | __le32 | s_first_meta_bg | First metablock block group, if the meta_bg feature is enabled. | ||||||||||||||||||||||||||||||
| 0x108 | __le32 | s_mkfs_time | When the filesystem was created, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x10C | __le32 | s_jnl_blocks[17] | Backup copy of the journal inode's i_block[] array in the first 15 elements and i_size_high and i_size in the 16th and 17th elements, respectively. |
||||||||||||||||||||||||||||||
| 64bit support valid if EXT4_FEATURE_COMPAT_64BIT | |||||||||||||||||||||||||||||||||
| 0x150 | __le32 | s_blocks_count_hi | High 32-bits of the block count. | ||||||||||||||||||||||||||||||
| 0x154 | __le32 | s_r_blocks_count_hi | High 32-bits of the reserved block count. | ||||||||||||||||||||||||||||||
| 0x158 | __le32 | s_free_blocks_count_hi | High 32-bits of the free block count. | ||||||||||||||||||||||||||||||
| 0x15C | __le16 | s_min_extra_isize | All inodes have at least # bytes. | ||||||||||||||||||||||||||||||
| 0x15E | __le16 | s_want_extra_isize | New inodes should reserve # bytes. | ||||||||||||||||||||||||||||||
| 0x160 | __le32 | s_flags | Miscellaneous flags. Any of:
|
||||||||||||||||||||||||||||||
| 0x164 | __le16 | s_raid_stride | RAID stride. This is the number of logical blocks read from or written to the disk before moving to the next disk. This affects the placement of filesystem metadata, which will hopefully make RAID storage faster. | ||||||||||||||||||||||||||||||
| 0x166 | __le16 | s_mmp_interval | # seconds to wait in multi-mount prevention (MMP) checking. In theory, MMP is a mechanism to record in the superblock which host and device have mounted the filesystem, in order to prevent multiple mounts. This feature does not seem to be implemented... | ||||||||||||||||||||||||||||||
| 0x168 | __le64 | s_mmp_block | Block # for multi-mount protection data. | ||||||||||||||||||||||||||||||
| 0x170 | __le32 | s_raid_stripe_width | RAID stripe width. This is the number of logical blocks read from or written to the disk before coming back to the current disk. This is used by the block allocator to try to reduce the number of read-modify-write operations in a RAID5/6. | ||||||||||||||||||||||||||||||
| 0x174 | __u8 | s_log_groups_per_flex | Size of a flexible block group is 2 ^ s_log_groups_per_flex. |
||||||||||||||||||||||||||||||
| 0x175 | __u8 | s_checksum_type | Metadata checksum algorithm type. The only valid value is 1 (crc32c). | ||||||||||||||||||||||||||||||
| 0x176 | __le16 | s_reserved_pad | |||||||||||||||||||||||||||||||
| 0x178 | __le64 | s_kbytes_written | Number of KiB written to this filesystem over its lifetime. | ||||||||||||||||||||||||||||||
| 0x180 | __le32 | s_snapshot_inum | inode number of active snapshot. (Not used in e2fsprogs/Linux.) | ||||||||||||||||||||||||||||||
| 0x184 | __le32 | s_snapshot_id | Sequential ID of active snapshot. (Not used in e2fsprogs/Linux.) | ||||||||||||||||||||||||||||||
| 0x188 | __le64 | s_snapshot_r_blocks_count | Number of blocks reserved for active snapshot's future use. (Not used in e2fsprogs/Linux.) | ||||||||||||||||||||||||||||||
| 0x190 | __le32 | s_snapshot_list | inode number of the head of the on-disk snapshot list. (Not used in e2fsprogs/Linux.) | ||||||||||||||||||||||||||||||
| 0x194 | __le32 | s_error_count | Number of errors seen. | ||||||||||||||||||||||||||||||
| 0x198 | __le32 | s_first_error_time | First time an error happened, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x19C | __le32 | s_first_error_ino | inode involved in first error. | ||||||||||||||||||||||||||||||
| 0x1A0 | __le64 | s_first_error_block | Number of block involved of first error. | ||||||||||||||||||||||||||||||
| 0x1A8 | __u8 | s_first_error_func[32] | Name of function where the error happened. | ||||||||||||||||||||||||||||||
| 0x1C8 | __le32 | s_first_error_line | Line number where error happened. | ||||||||||||||||||||||||||||||
| 0x1CC | __le32 | s_last_error_time | Time of most recent error, in seconds since the epoch. | ||||||||||||||||||||||||||||||
| 0x1D0 | __le32 | s_last_error_ino | inode involved in most recent error. | ||||||||||||||||||||||||||||||
| 0x1D4 | __le32 | s_last_error_line | Line number where most recent error happened. | ||||||||||||||||||||||||||||||
| 0x1D8 | __le64 | s_last_error_block | Number of block involved in most recent error. | ||||||||||||||||||||||||||||||
| 0x1E0 | __u8 | s_last_error_func[32] | Name of function where the most recent error happened. | ||||||||||||||||||||||||||||||
| 0x200 | __u8 | s_mount_opts[64] | ASCIIZ string of mount options. | ||||||||||||||||||||||||||||||
| 0x240 | __le32 | s_usr_quota_inum | Inode number of user quota file. | ||||||||||||||||||||||||||||||
| 0x244 | __le32 | s_grp_quota_inum | Inode number of group quota file. | ||||||||||||||||||||||||||||||
| 0x248 | __le32 | s_overhead_blocks | Overhead blocks/clusters in fs. (Huh? This field is always zero, which means that the kernel calculates it dynamically.) | ||||||||||||||||||||||||||||||
| 0x24C | __le32 | s_backup_bgs[2] | Block groups containing superblock backups (if sparse_super2) | ||||||||||||||||||||||||||||||
| 0x254 | __u8 | s_encrypt_algos[4] | Encryption algorithms in use. There can be up to four algorithms in use at any time; valid algorithm codes are given below:
|
||||||||||||||||||||||||||||||
| 0x258 | __u8 | s_encrypt_pw_salt[16] | Salt for the string2key algorithm for encryption. | ||||||||||||||||||||||||||||||
| 0x268 | __le32 | s_lpf_ino | Inode number of lost+found | ||||||||||||||||||||||||||||||
| 0x26C | __le32 | s_prj_quota_inum | Inode that tracks project quotas. | ||||||||||||||||||||||||||||||
| 0x270 | __le32 | s_checksum_seed | Checksum seed used for metadata_csum calculations. This value is crc32c(~0, $orig_fs_uuid). | ||||||||||||||||||||||||||||||
| 0x274 | __le32 | s_reserved[98] | Padding to the end of the block. | ||||||||||||||||||||||||||||||
| 0x3FC | __le32 | s_checksum | Superblock checksum. | ||||||||||||||||||||||||||||||
Total size is 1024 bytes.
EXT4 超级块介绍(转)的更多相关文章
- linux操作系统故障处理-ext4文件系统超级块损坏修复
linux操作系统故障处理-ext4文件系统超级块损坏修复 背景 前天外面出差大数据测试环境平台有7台服务器挂了,同事重启好了五台服务器,但是还有两台服务器启动不起来,第二天回来后我和同事再次去机 ...
- Linux 文件系统错误的修复方法 ddrescue替代dd的恢复软件 备用超级块
Linux 文件系统错误的修复方法 ddrescue替代dd的恢复软件 备用超级块 最近处理的一件 linux 服务器断电导致文件系统启动后文件系统不可读写,数据不可用的案例,现总结下 Linux ...
- Linux 虚拟文件系统四大对象:超级块、inode、dentry、file之间关系
更多嵌入式原创文章,请关注公众号:一口Linux 一:文件系统 1. 什么是文件系统? 操作系统中负责管理和存储文件信息的软件机构称为文件管理系统,简称文件系统. 通常文件系统是用于存储和组织文件的一 ...
- 81 dumpe2fs-打印“ext2/ext3”文件系统的超级块和快组信息
dumpe2fs打印"ext2/ext3"文件系统的超级块和快组信息. 语法 dumpe2fs (选项) (参数) 选项 -b:打印文件系统中预留的块信息: -ob<超级块& ...
- 从ext2文件系统上读出超级块
概述 本篇博客中,我们将仔细分析如何从格式化为ext2文件系统的磁盘中读取超级块并填充内存超级块结构,每次将一个格式化了ext2文件系统的磁盘(分区)挂载到挂载点的时候会调用该方 ...
- itop4412学习-超级块操作
1. 先看下超级块支持的函数列表,文件路径\4412_SCP精英版\Android源码\iTop4412_Kernel_3.0_20140521\iTop4412_Kernel_3.0\include ...
- 一步一步粗谈linux文件系统(三)----超级块(superblock)【转】
本文转载自:https://blog.csdn.net/fenglifeng1987/article/details/8302921 超级块是来描述整个文件系统信息的,可以说是一个全局的数据结构,可以 ...
- 文件系统VFS数据结构(超级块 inode dentry file)(收集整理)
Linux虚拟文件系统四大对象: 1)超级块(super block) 2)索引节点(inode) 3)目录项(dentry) 4)文件对象(file) 一个进程在对一个文件进行操作时各种对象的引用过 ...
- 超级块,i节点,数据块,目录块,间接块
一.物理磁盘到文件系统 文件系统用来存储文件内容,文件属性,和目录,这些类型的数据如何存储在磁盘块上的呢?Unix/linux使用了一个简单的方法. 他将磁盘分为3个部分: 超级块,文件系统中第一个块 ...
随机推荐
- Linux:软件包安装
软件包安装 一.rpm安装 1.挂载系统:mount /dev/cdrom/ /mnt/cdrom/ 2.进入相应的目录(Centos7 为Packages,有一些是Server):cd /mnt/c ...
- nginx保持会话的方式
1)ip_hash 简单易用,但是有如下缺点 后端服务器宕机后,session会丢失 来自同一局域网的客户端会被转发到同一个后端服务器,可能导致负载失衡 不适用CDN网络,不适用于前段还有代理的情况 ...
- js常用到的方法积累
//获取对象长度的方法 function countObjLen(obj) { var count = 0; for (var property in obj) { if (Object.protot ...
- express框架以及配置项
以上命令会将 Express 框架安装在当前目录的 node_modules 目录中, node_modules 目录下会自动创建 express 目录.以下几个重要的模块是需要与 express 框 ...
- JAVA_工具类01_ResourceBundle
在java.util.ResourceBundle包下,是java提供的工具类 ResourceBundle只能读取properties文件中的内容,可以使用ResourceBundle的静态方法来创 ...
- JAVA中的Set
Set中存放的是没有重复的数据,下说记录一下使用中的小细节. 1.HashSet 区分大小写: Set<String> set1 = new HashSet<String>() ...
- linux下开启oracle服务和开启监听
su - oracle 切换到oracle用户模式下 sqlplus /nolog //登录sqlplus SQL> connect /as sysdba //连接oracle SQL&g ...
- Spring Boot 揭秘与实战(五) 服务器篇 - 内嵌的服务器 Tomcat剖析
文章目录 1. 内嵌的 Tomcat,一个Jar包运行 2. 如何定制内嵌 Tomcat3. War 包部署的使用细节 2.1. 设置内嵌Tomcat的端口 2.2. 设置内嵌Tomcat的最大线程数 ...
- selenium的webdriver三种等待方式(显式等待WebDriverWait+implicitly_wait隐式等待+sleep强制等待)
隐式等待是等页面加载,不是等元素!!! 1.显式等待 一个显式等待是你定义的一段代码,用于等待某个条件发生然后再继续执行后续代码.显式等待是等元素加载!!! 2.隐式等待,相当于设置全局的等待,在定位 ...
- 在 Mac 安装Docker
https://blog.csdn.net/jpiverson/article/details/50685817 https://legacy.gitbook.com/book/yeasy/docke ...