[ext4]08 磁盘布局 - CheckSums
从2012年开始,Ext4和jbd2的元数据中都开始加入checksums。特性标识是metadata_csum。Checksum算法是在super_block中指定:
struct ext4_super_block {
…
__u8 s_log_groups_per_flex; /* FLEX_BG group size */
__u8 s_checksum_type; /* metadata checksum algorithm used */
…
}
但是在当前版本(3.13)中,依旧仅支持一种校验算法CRC32c。
在Ext4系统中,并不是所有的元数据校验值都是保存全部的32校验和,某些元数据因为考虑到数据结构的兼容性问题仅保存校验和的低16位数值。到那时如果开启64bit特性,所有的元数据校验值将保存全部的32位校验和。
Ext4系统中使用CRC32校验的元数据:
Metadata |
Length |
Ingredients |
Superblock |
__le32 |
The entire superblock up to the checksum field. The UUID lives inside the superblock. |
MMP |
__le32 |
UUID + the entire MMP block up to the checksum field. |
Extended Attributes |
__le32 |
UUID + the entire extended attribute block. The checksum field is set to zero. |
Directory Entries |
__le32 |
UUID + inode number + inode generation + the directory block up to the fake entry enclosing the checksum field. |
HTREE Nodes |
__le32 |
UUID + inode number + inode generation + all valid extents + HTREE tail. The checksum field is set to zero. |
Extents |
__le32 |
UUID + inode number + inode generation + the entire extent block up to the checksum field. |
Bitmaps |
__le32 or __le16 |
UUID + the entire bitmap. Checksums are stored in the group descriptor, and truncated if the group descriptor size is 32 bytes (i.e. ^64bit) |
Inodes |
__le32 |
UUID + inode number + inode generation + the entire inode. The checksum field is set to zero. Each inode has its own checksum. |
Group Descriptors |
__le16 |
If metadata_csum, then UUID + group number + the entire descriptor; else if uninit_bg, then crc16(UUID + group number + the entire descriptor). In all cases, only the lower 16 bits are stored. |
posted on 2014-03-27 14:19 YoungerChina 阅读(607) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人