Linux file system

Source: Internet
Author: User

A Linux file system typically consists of three parts: Superblock, Inode, block (the concept of block consists of disk drives).

↓

      • Superblock: Record The overall information of this filesystem, including the total amount of inode/block, the amount of use, the amount of surplus, and the format and related information of the file system;
      • Inode: Records the properties of a file, a file occupies an inode, while recording the block number of the file's data;
      • Block: The actual record of the contents of the file, if the file is too large, will occupy more than block.

As shown, the file system first formats the Inode and block blocks, assuming that a file's attributes and permissions data is placed in the inode 4th (smaller squares), and this inode recorded the actual placement of the file data points are 2, 7, 13, 15 of these four block numbers, at this time Our operating system will be able to arrange the reading order of the disks, so that we can read the contents of the four blocks in one breath! Then the reading of the data is like the arrows specified in the shape.

Inode/block data Access

This method of data access is called an indexed file system (indexed allocation). Is there any other idiomatic file system that can be compared? Yes, that's our usual flash drive (flash), the file system used in the flash drive is generally in FAT format. The FAT file system does not exist in this format, so fat has no way to read all blocks of the file from the beginning. Each block number is recorded in the previous block, and he reads a bit like this:


FAT file system data access

We assume that the data in the file is written sequentially to the four block numbers of the 1->7->4->15 number, but this filesystem has no way of knowing the number of four blocks in one breath, and he will have to read the block in a single time before he knows where the next block is. If the block that writes the same file data is too fragmented, our disk read head will not be able to read all the data on the disk, so the disk will be more than a few laps to complete the contents of this file!

Do you often hear the so-called "defragmentation"? The reason for defragmentation is that the block of file writes is too discrete, and the performance of the file reads becomes poor. This time can be through the defragmentation of the same file belongs to the blocks together, so that the data will be easier to read! Assuming that the FAT file system needs to be regularly defragmented, does Ext2 need disk re-use?

Since EXT2 is an indexed file system, it is largely not necessary to defragment it frequently. However, if the file system is used too long, often delete/edit/Add files, then it is possible to cause the file data is too discrete problem, this time may need to be restructured.

A selection of the Linux private dishes from Brother Bird Simplified Chinese station

Linux file system

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.