浅析Linux标准的文件系统(Ext2/Ext3/Ext4)

Ext

全称Linux extended file system, extfs,即Linux扩展文件系统,Ext2就代表第二代文件扩展系统,Ext3/Ext4以此类推,它们都是Ext2的升级版,只不过为了快速恢复文件系统,减少一致性检查的时间,增加了日志功能,所以Ext2被称为索引式文件系统,而Ext3/Ext4被称为日志式文件系统

备注:Linux支持很多文件系统,包括网络文件系统(NFS)、Windows的Fat文件系统。

查看Linux支持的文件系统:ls -l /lib/modules/$(uname -r)/kernel/fs

查看Linux支持的文件系统(已载入到内存中):cat /proc/filesystems

核心设计

数据存放区

这些元素相对稳定,磁盘格式化后,就固定下来了。

  • inode(索引节点)
    记录文件的权限、属性和数据所在块block的号码,每个文件都有且仅有一个的inode,每个inode都有自己的编号,可以把inode简单地理解为文档索引
备注:在磁盘格式化后,inode的大小和数量都已经固定了,大小均为128Bytes(新的Ext4和xfs为258Bytes)。读取文件时,先读取inode里面记录的文件属性和权限,匹配正确后,才会读取文件内容(block)。 在Linux系统中,实际使用inode来识别文件,而不是文件名,类似于用户标识和昵称的设计
  • inode table
    存储文件系统的所有inode编号的表格
  • block(数据区块)
    存储的文件内容,也叫数据区块(data block),每个block都有自己的编号,Ext2支持的单位block容量仅为1k、2k、4k
备注:为了方便inode的记录,在磁盘格式化后,block的大小都已经固定了。每一个块只能存放一个文件的数据,若文件太大,将占用多个block;若文件太小,block剩余空间就不能被使用了,就会导致 磁盘空间浪费&
  • 24
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以读写Ext2,以Ext2方式挂载Ext3文件系统(不支持Ext3日志),不支持中文! It provides Windows NT4.0/2000/XP/2003/Vista/2008 with full access to Linux Ext2 volumes (read access andwrite access). This may be useful if you have installed both Windows and Linux as a dual boot environment on your computer. What features are supported? Complete reading and writing access to files and directories of volumes with theExt2 orExt3 file system. Supports features which are specific to the I/O-system of Windows: Byte Range Locks, Directory Notfication (so the Explorer updates the view of a directory on changes within that directory), Oplocks (so SMB clients are able to cache the content of files). Allows Windows to run with paging files on Ext2 volumes. UTF-8 encoded file names are supported. The driver treats files with file names that start with a dot "." character ashidden. Supports GPT disks if the Windows version used also does. Supports use of the Windows mountvol utility to create or delete drive letters for Ext2 volumes (except on Windows NT 4.0). See also section"Can drive letters also be configured from scripts?". What features are *not* supported? Inodes that are larger than 128 bytes are not supported. Access rights are not maintained. All users can access all the directories and files of an Ext2 volume. If a new file or directory is created, it inherits all the permissions, the GID and the UID from the directory where it has been created. There is one exception to this rule: a file (but not a directory) the driver has created always has cleared "x" permissions, it inherits the "r" and the "w" permissions only. See also section"What limitations arise from not maintaining access rights?". The driver does not allow accessing special files at Ext2 volumes, the access will be always denied. (Special files are sockets, soft links, block devices, character devices and pipes.) Alternate 8.3-DOS names are not supported (just because there is no place to store them in an Ext2 file system). This can prevent legacy DOS applications, executed by the NTVDM of Windows, from accessing some files or directories. Currently the driver does not implement defragging support. So defragmentation applications will neither show fragmentation information nor defragment any Ext2 volume. This software does not achieve booting a Windows operating system from an Ext2 volume. LVM volumes are not supported, so it is not possible to access them.
ext2/3,扩展文件系统,常用于Linux操作系统。是很多Linux发行版的默认文件系统Linux ext2/ext3文件系统使用索引节点来记录文件信息,作用像windows的文件分配表。 索引节点(inode)是一个结构,它包含了一个文件的长度、创建及修改时间、权限、所属关系、磁盘中的位置等信息。 一个文件系统维护了一个索引节点的数组(GroupDesc),每个文件或目录都与索引节点数组中的唯一一个元素对应。 系统给每个索引节点分配了一个号码,也就是该节点在数组中的索引号,称为索引节点号。 linux文件系统将文件索引节点号和文件名同时保存在目录中。所以,目录只是将文件的名称和 它的索引节点号结合在一起的一张表,目录中每一对文件名称和索引节点号称为一个连接。 对于一个文件 来说有唯一的索引节点号与之对应,对于一个索引节点号,却可以有多个文件名与之对应。因此,在磁盘 上的同一个文件可以通过不同的路径去访问它。 本程序是一个ext2/ext3文件系统查看器(ext4暂不支持).可以打开镜像文件及硬盘设备文件查看具体的 文件系统结构信息,如超级块,块组信息,文件inode,目录信息,文件信息,提取文件内容等。本人写这个程序就是 为了学习一下ext2/3,也希望通过本程序能让读者了解ext2/3文件系统结构. 具体使用方法请看readme

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值