The principle and realization of the file system of Ext series

Source: Internet
Author: User

Now the book tube serves as a work of managing a large number of books. Imagine if the library librarian didn't classify the book, but placed the book directly on the bookshelf. So the people who come to books to find books about history or science, how should he look for it? Obviously he had to find out all the books in the library, and if he was lucky, the first was the book he wanted to find; in other words, if he wasn't lucky, the last book was the one he wanted to find. You can imagine how much time he wasted.

However, in real life the library does not put all the books directly on the shelves, but the classification of books, scientific class on the first shelf, the history of the class on the second shelf, literature on the fourth and fifth shelves. In this way, if you go to the library to find books on history, you just need to find the books you need on the bookshelf where the history books are located. This will greatly reduce the time you find the books you need.

In some of the larger libraries. He did not just classify the books, he would set up an information board on the first floor of the book, which indicated that the books of history were in the second tier of the first few libraries, the books of the scientific class in the third library ..., and in each library there are also information cards. Take the example of history: The book on the history of the Han Dynasty on the first shelves, the history of the Tang Dynasty books on the first few shelves, modern history of books on the first few shelves. By this means, each different person to the library when looking for books, only need to enter the library hall, look at the information card to find the book in the first few libraries, and then to the relevant library outside the door, and then look at the information card to find the book is probably in which bookshelf, And then you can quickly find the books you need. In theory, every person needs a book as long as there is one in the library, so the time to find books is almost the same.

File system from a certain point of view, can be said to be a comparative large library, it in some way to organize a large number of files on disk, and different file system file organization may not be the same way. Imagine if you put 100G of data on disk, and there is no file system on the disk, directly heap on the hard disk. But the program runtime data may not exist in memory, then the program needs to tell the kernel, I want to find some data on the disk, the kernel will go to the disk to find relevant data, because the disk does not create a file system, the kernel will need to traverse the entire disk until the data is found. What if the data is found at the end? You can imagine how long it took the kernel to find the relevant data for the program.

Therefore, it is necessary for a computer to have a specific way to organize the files on disk storage, thus enabling fast access to the data on disk at a fixed time. This particular approach is actually the filesystem, and the file system is generally implemented on the partition of the disk.

Since we're talking about disks, let's talk about the composition of the disk. The internal structure of the disk is made up of one or more platters, each of which has two disk faces. In general, there is a head in the area close to each disk to read and write data. And each disk can be divided into a lot of concentric circles, in the hard drive factory, the manufacturers will each hard disk to do low-level format, so that the different concentric circles on the disk for different tracks (track), the tracks are many in the same track of the sector (sector) composition, Each sector size is 512 bytes (byte). On the same track on different discs we call it a cylinder (cylinder). When partitioning a disk, we partition the disk's cylinders. The same cylinder can belong to only one partition.

Because the file system sector is not convenient for disk management, the multiple sectors are organized into disk blocks (block),

Each disk block is numbered in the file's decency.

Next we talk about the basic structure of the EXT series file system:

The file system of the EXT series is made up of the metadata area and data area.

The metadata area also contains the following content:

Inode: An index node, which is equivalent to the information board in the lobby of a library, and the index node contains the following information:

Inode Number: inode node number

Permissions for files: The owner, group, and other people of the file, the rights of these three categories of users

Owner of File: owner of File

Genus of files: a group of files

Timestamp of the file: Access time (access), modified time (modify), time changed (change)

Number of each disk block where the file resides:

Inode bitmap: Each inode in the metadata area uses one of the inode bitmaps to identify whether this inode is an idle inode.

Block Bitmap: Each block in the data area uses one of the inode bitmaps to identify if this block is an idle block.

What the data area contains:

File Block: Stores the entire or partial file data.

Directory Block: Store file names and corresponding inode numbers in the directory

All files or directories in the EXT series file system have their corresponding inode nodes and related attributes in the metadata area, and single or directory names are in the disk blocks of the storage data area, not in the disk blocks of the metadata area.

To be Continued ...




This article is from "Chalet Technology" blog, please make sure to keep this source http://starli.blog.51cto.com/8813574/1660200

The principle and realization of the file system of Ext series

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.