Ext3 file tree built by Inode

Source: Internet
Author: User
Tags file system resource

How can you get a better understanding of a file system? I think first of all, we should start with the metadata distribution of file system on disk, then look at the software implementation of file system, such as the structure in memory and the operation mode of metadata, etc. Here I want to get to know the Ext3 file tree by ext3 the metadata information on the disk.

Consider what basic elements we need to store on disk if we want to implement a file system? How do you organize the relationship between files and directories? How do I manage actual blocks of physical resources? In the Ext3 file system, the Inode is an important part of the data structure, which organizes the whole EXT3 file system framework. In addition, the physical resource group management method is used in the Ext3 file system, and the bitmap bitmap information is used to describe the use of the physical block.

The file system's data on disk is distributed as shown in the following illustration:

EXT3 organizes all of the physical disk space in a block group, and Superblock and block set description information can be stored in blocks in a sparse way. There are two of the most important members in each block group:

1,inode blocks and their bitmap. The inode bitmap is used to describe the usage of the Inode resource block in this block group, Blk for Inodes is the resource block used to store the inode. When an inode needs to be allocated, the file system needs to place the corresponding bitmap.

2,blks blocks and their bitmap. In each block group, most of the space is occupied by the data resource block, and the use of the blocks bitmap is described. When a resource block needs to be allocated, the file system needs to place the corresponding bitmap.

The inode is the link of the ext3 file system, how does it express the file system? The following figure illustrates the file system tree built using Inode.

In the ext3 file system, there must be a root inode, where the inode is fixed on the disk, and the root inode is the portal to the file system when the file system is started. The root inode describes a directory entry that stores entries in the block of data that it points to. Each directory entry points to the next inode, and if the directory entry describes a normal file, the next Inode allocates the physical block and stores the file data in the physical block, and if the directory entry describes the next level of directory, The next Inode-allocated block will store directory entries for the next level of directories. With Inode and directory entries, ext3 constructs a large file tree.

Once you have an inode-based file tree in mind, it is relatively easy to read and analyze the EXT3 software implementation code. In addition, if we want to do ext3 file system data Recovery, then we also need to understand such a file tree, as well as the detailed definition of the data structure.

This article is from the "Save the Way" blog, please be sure to keep this source http://alanwu.blog.51cto.com/3652632/1092313

See more highlights of this column: http://www.bianceng.cn/database/storage/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.