EXT4 数据结构

高级数据结构设计

Blocks

EXT4 以为单位分配存储空间。块是一组扇区介于 1KiB 和 64KiB 之间,扇区数量必须为 2 的整数幂。块又被分组成更大的单元,称为块组。默认情况下,文件系统可以包含 2^32 个块,启用 64 bits feature,则文件系统可以有 2^64 个块。

Layout

标准块组的布局:

Group 0 Paddingext4 Super BlockGroup DescriptorsReserved GDT BlocksData Block Bitmapinode Bitmapinode TableData Blocks
1024 bytes1 blockmany blocksmany blocks1 block1 blockmany blocksmany more blocks

对于块组 0 的特殊情况,前 1024 个字节未使用, 允许安装 x86 引导扇区。 超级块将从偏移量 1024 字节开始。如果块大小 = 1024,则块 0 标记为使用中,超级块就处于块 1。

Flexible Block Groups

ext4 开始,flex_bg 中几个块组被捆绑在一起作为一个 逻辑块组,bitmap 空间和 inode Table 空间 flex_bg 的第一个块组被扩展为包括位图以及 flex_bg 中所有其他块组的 inode 表。

Meta Block Groups

Special inodes

ext4 为特殊功能预留了一些 inode,如下所示:

inode 编号目的
0没有 inode 0。
1有缺陷的块的列表。
2Root directory
3User quota
4Group quota
5Boot loader
6Undelete directory
7Reserved group descriptors inode(调整 Inode)
8Journal inode
9exclude inode,用于快照
10Replica inode
11lost+found

Checksums

Inline Data

  • 文件小于 60 字节,数据就会内嵌存储在 inode.i_block 中。
  • 文件的其余部分可以容纳在扩展属性空间内,那么就可以在 inode 主体(“ibody EA”)中找到扩展属性 “system.data”。 当然,这也限制了一个 inode 可以附加的扩展属性数量。
  • 数据大小超过 i_block + ibody EA,就会分配一个常规块,并将内容移至该块。
Inline Directories

i_block 的前四个字节是父目录的 inode 编号。 之后是 56 字节的目录条目数组空间;参见 struct ext4_dir_entry。 如果 inode 主体中有 "system.data "属性,则 EA 值也是 struct ext4_dir_entry 数组。 请注意,对于内联目录,i_block 和 EA 空间被视为独立的 dirent 块;目录条目不能跨越这两个块。 内联目录条目不进行校验和,因为 inode 校验和应保护所有内联数据内容。

全局数据结构

Super Block

OffsetSizeNameDescription
0x0__le32s_inodes_count节点总数
0x4__le32s_blocks_count_lo区块总数
0x8__le32s_r_blocks_count_loThis number of blocks can only be allocated by the super-user.
0xC__le32s_free_blocks_count_lo空闲块计数
0x10__le32s_free_inodes_count空闲 inode 数量
0x14__le32s_first_data_block第一个数据块, 对于 1k 块的文件系统,该值必须至少为 1,对于所有其他块大小,该值通常为 0
0x18__le32s_log_block_size块大小为 2 ^ (10 + s_log_block_size)。
0x1C__le32s_log_cluster_sizeCluster size is 2 ^ (10 + s_log_cluster_size) blocks if bigalloc is enabled. Otherwise s_log_cluster_size must equal s_log_block_size.
0x20__le32s_blocks_per_group每组块数
0x24__le32s_clusters_per_groupClusters per group, if bigalloc is enabled. Otherwise s_clusters_per_group must equal s_blocks_per_group.
0x28__le32s_inodes_per_group每个组的 Inodes 数
0x2C__le32s_mtimeMount time, in seconds since the epoch.
0x30__le32s_wtimeWrite time, in seconds since the epoch.
0x34__le16s_mnt_countNumber of mounts since the last fsck.
0x36__le16s_max_mnt_countNumber of mounts beyond which a fsck is needed.
0x38__le16s_magic标识签名, 0xEF53
0x3A__le16s_stateFile system state. See super_state for more info.
0x3C__le16s_errorsBehaviour when detecting errors. See super_errors for more info.
0x3E__le16s_minor_rev_levelMinor revision level.
0x40__le32s_lastcheckTime of last check, in seconds since the epoch.
0x44__le32s_checkintervalMaximum time between checks, in seconds.
0x48__le32s_creator_osCreator OS. See the table super_creator for more info.
0x4C__le32s_rev_levelRevision level. See the table super_revision for more info.
0x50__le16s_def_resuidDefault uid for reserved blocks.
0x52__le16s_def_resgidDefault gid for reserved blocks.
这些字段仅适用于 EXT4_DYNAMIC_REV 超级块。
0x54__le32s_first_inoFirst non-reserved inode.
0x58__le16s_inode_sizeinode 结构的大小(字节)
0x5A__le16s_block_group_nrBlock group # of this superblock.
0x5C__le32s_feature_compatCompatible feature set flags. Kernel can still read/write this fs even if it doesn’t understand a flag; fsck should not do that. See the super_compat table for more info.
0x60__le32s_feature_incompatIncompatible feature set. If the kernel or fsck doesn’t understand one of these bits, it should stop. See the super_incompat table for more info.
0x64__le32s_feature_ro_compatReadonly-compatible feature set. If the kernel doesn’t understand one of these bits, it can still mount read-only. See the super_rocompat table for more info.
0x68__u8s_uuid[16]128-bit UUID for volume.
0x78chars_volume_name[16]卷标
0x88chars_last_mounted[64]Directory where filesystem was last mounted.
0xC8__le32s_algorithm_usage_bitmapFor compression (Not used in e2fsprogs/Linux)
Performance hints. Directory preallocation should only happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
0xCC__u8s_prealloc_blocks#. of blocks to try to preallocate for … files? (Not used in e2fsprogs/Linux)
0xCD__u8s_prealloc_dir_blocks#. of blocks to preallocate for directories. (Not used in e2fsprogs/Linux)
0xCE__le16s_reserved_gdt_blocksNumber of reserved GDT entries for future filesystem expansion.
Journalling support is valid only if EXT4_FEATURE_COMPAT_HAS_JOURNAL is set.
0xD0__u8s_journal_uuid[16]UUID of journal superblock
0xE0__le32s_journal_inuminode number of journal file.
0xE4__le32s_journal_devDevice number of journal file, if the external journal feature flag is set.
0xE8__le32s_last_orphanStart of list of orphaned inodes to delete.
0xEC__le32s_hash_seed[4]HTREE hash seed.
0xFC__u8s_def_hash_versionDefault hash algorithm to use for directory hashes. See super_def_hash for more info.
0xFD__u8s_jnl_backup_typeIf 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__le16s_desc_sizeSize of group descriptors, in bytes, if the 64bit incompat feature flag is set.
0x100__le32s_default_mount_optsDefault mount options. See the super_mountopts table for more info.
0x104__le32s_first_meta_bgFirst metablock block group, if the meta_bg feature is enabled.
0x108__le32s_mkfs_timeWhen the filesystem was created, in seconds since the epoch.
0x10C__le32s_jnl_blocks[17]

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/48987.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

谷粒商城实战笔记-65-商品服务-API-品牌管理-表单校验自定义校验器

文章目录 1,el-form品牌logo图片自定义显示2,重新导入和注册element-ui组件3,修改brand-add-or-update.vue控件的表单校验规则firstLetter 校验规则sort 校验规则 1,el-form品牌logo图片自定义显示 为了在品牌列表中自定义显示品…

Typora 以 Github 作为图床使用 PicGo 上传图片

本文简练快速介绍如标题所述的操作流程 文章目录 1.前言1.1 图床简述1.2 Github图床的优缺点1.2.1 优点1.2.2 缺点 2.下载PicGo3.Github访问加速4.用github创建图床服务器4.1 注册4.2 创建仓库 4.3 生成TOKEN令牌5.设置PicGo6.设置Typora7.完成 1.前言 1.1 图床简述 图床&…

人工智能背后的图灵测试(TuringTest)是什么?

人工智能背后的图灵测试(TuringTest)是什么? 一、什么是图灵测试 图灵测试(Turing Test)由英国数学家和计算机科学家阿兰图灵(Alan Turing)在1950年提出,用以判断机器是否具有人类智能。图灵在其论文《计…

SNIFFER:用于可解释性的虚假信息检测的多模态大语言模型

S NIFFER : Multimodal Large Language Model for Explainable Out-of-Context Misinformation Detection 论文地址: https://openaccess.thecvf.com/content/CVPR2024/papers/Qi_SNIFFER_Multimodal_Large_Language_Model_for_Explainable_Out-of-Context_Misinformation_D…

3.1、数据结构-线性表

数据结构 数据结构线性结构线性表顺序存储和链式存储区别单链表的插入和删除练习题 栈和队列练习题 串(了解) 数据结构 数据结构该章节非常重要,上午每年都会考10-12分选择题下午一个大题 什么叫数据结构?我们首先来理解一下什…

【Android】碎片—动态添加、创建Fragment生命周期、通信

简单用法 在一个活动中添加两个碎片&#xff0c;并让这两个碎片平分活动空间 先新建一个左侧碎片布局和一个右侧碎片布局 左侧碎片 <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas.android.com/apk/…

Unity Android接入SDK 遇到的问题

1. buildtools、platformtools、commandline tools 以及compiled sdk version、buildtools sdk version、target sdk version 的说明 Android targetSdkVersion了解一下 - 简书 2. 查看.class 和.jar文件 jd_gui 官网地址&#xff1a; 下载jd_gui 工具 &#xff0c;或者 idea 下…

ITK-均值滤波

作者&#xff1a;翟天保Steven 版权声明&#xff1a;著作权归作者所有&#xff0c;商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处 均值滤波原理 均值滤波是一种常用的图像平滑技术&#xff0c;用于减少图像中的噪声。其基本原理是通过计算图像中每个像素及其邻…

linux ftp操作记录

一.ftp 创建用户 passwd: user ftpuser does not exist 如果你遇到 passwd: user ftpuser does not exist 的错误&#xff0c;这意味着系统中不存在名为 ftpuser 的用户。你需要首先确认FTP用户是否是系统用户&#xff0c;还是FTP服务器软件&#xff08;如Pure-FTPd&#xff…

【React】通过实际示例详解评论列表渲染和删除

文章目录 一、引言二、初始状态与状态更新1. 使用useState钩子管理状态2. 评论列表的初始数据 三、列表渲染的实现1. list.map(item > { ... })2. return 语句3. JSX 语法4. 为什么这样设计5. 完整解读 四、列表项的唯一标识1. key 的作用2. key 的用法3. 可以没有 key 吗&a…

【Stable Diffusion】(基础篇五)—— 使用SD提升分辨率

使用SD提升分辨率 本系列博客笔记主要参考B站nenly同学的视频教程&#xff0c;传送门&#xff1a;B站第一套系统的AI绘画课&#xff01;零基础学会Stable Diffusion&#xff0c;这绝对是你看过的最容易上手的AI绘画教程 | SD WebUI 保姆级攻略_哔哩哔哩_bilibili 在前期作画的…

c++ 构造函数与析构函数

本文参考菜鸟教程&#xff0c;仅作笔记用。 构造函数 构造函数&#xff08;Constructor&#xff09;是一种特殊的方法&#xff0c;用于在创建对象时进行初始化操作。构造函数的名称与类的名称是完全相同的&#xff0c;并且不会返回任何类型&#xff0c;也不会返回 void。在面…

Pytorch使用教学4-张量的索引

1 张量的符号索引 张量也是有序序列&#xff0c;我们可以根据每个元素在系统内的顺序位置&#xff0c;来找出特定的元素&#xff0c;也就是索引。 1.1 一维张量的索引 一维张量由零维张量构成 一维张量索引与Python中的索引一样是是从左到右&#xff0c;从0开始的&#xff…

ubuntu cmake使用自己版本的qt

给一篇文章参考 https://blog.csdn.net/bank_dreamer/article/details/138678909 自己使用的范例 set(Qt5_DIR "/home/peak/Qt5.14.0/5.14.0/gcc_64/lib/cmake/Qt5")# 设置Qt5的安装目录 #set(CMAKE_PREFIX_PATH "/home/peak/Qt5.14.0")find_package(Qt5…

搭建NFS、web、dns服务器

目录 1、搭建一个nfs服务器&#xff0c;客户端可以从该服务器的/share目录上传并下载文件 服务端配置&#xff1a; 客户端测试&#xff1a; 2、搭建一个Web服务器&#xff0c;客户端通过www.haha.com访问该网站时能够看到内容:this is haha 服务端配置&#xff1a; 客户端…

ubuntu升级gdb

安装 下载网址 https://ftp.gnu.org/gnu/gdb/ wget https://ftp.gnu.org/gnu/gdb/gdb-11.1.tar.xz xz -d gdb-11.1.tar.xz tar xvf gdb-11.1.tar编译 cd gdb-11.1 ./configure make -j4 sudo make install问题 makeinfo‘ is missing on your system sudo apt install te…

WEB渗透Web突破篇-SQL注入(MSSQL)

注释符 -- 注释 /* 注释 */用户 SELECT CURRENT_USER SELECT user_name(); SELECT system_user; SELECT user;版本 SELECT version主机名 SELECT HOST_NAME() SELECT hostname;列数据库 SELECT name FROM master..sysdatabases; SELECT DB_NAME(N); — for N 0, 1, 2, ……

【Web爬虫逆向】“企业预警通”模糊查询公司信息,逆向案例实战

“企业预警通”模糊查询公司信息&#xff0c;逆向案例实战 功能介绍效果演示思路分析1、先找到模糊查询的接口2、分析headers与params中参数并进行构造3、JS逆向&#xff0c;跟栈&#xff0c;找到js中key和dataCategory的生成方法&#xff0c;并完成js补码构造4、成功还原key后…

设计模式总结:适配器、桥接、组合和迭代器模式

在之前的对话中&#xff0c;我们讨论了五种常见的 Java 设计模式&#xff1a;单例、工厂、策略、装饰器和观察者模式。现在&#xff0c;让我们继续探索其他四种设计模式&#xff1a;适配器、桥接、组合和迭代器模式。 适配器模式 概念&#xff1a; 适配器模式是一种结构型设计…

UART编程框架详解

1. UART介绍 UART&#xff1a;通用异步收发传输器&#xff08;Universal Asynchronous Receiver/Transmitter)&#xff0c;简称串口。 调试&#xff1a;移植u-boot、内核时&#xff0c;主要使用串口查看打印信息 外接各种模块 1.1 硬件知识_UART硬件介绍 UART的全称是Unive…