Understanding the Linux Standard file system (EXT2/EXT3/EXT4)

Source: Internet
Author: User

Ext

The full name of the Linux extended file system, EXTFS, the Linux extension filesystem, EXT2 represents the second generation of file extension systems, EXT3/EXT4 and so on, they are EXT2 upgrade version, but added the log function, and backward compatibility, So Ext2 is called an indexed file system , and EXT3/EXT4 is called a journaled file system .

Note: Linux supports many file systems, including the network File System (NFS), the FAT file system for Windows.

To view Linux supported file systems:ls -l /lib/modules/$(uname -r)/kernel/fs

View Linux supported file systems (loaded into memory):cat /proc/filesystems

Core Design Data area

These elements are relatively stable and are fixed after the disk is formatted.

    • Inode (Index node)
      Record the permissions, attributes, and numbers of the block in which the file is located, block each with and only one inode , each inode with its own number, which can be inode simply understood as a document index .

      Note: After the disk is formatted, the inode size and number are fixed, and the size is 128Bytes (the new EXT4 and XFS are 258Bytes). When reading a file, read the file attributes and permissions recorded in the Inode, and the file contents (block) will be read only after the matching is correct.

    • Block (data block)
      The stored file content, also known as data block, each block has its own number, Ext2 the supported unit block capacity is only 1k, 2k, 4k.

      Note: In order to facilitate the logging of the inode, the size of the block has been fixed after the disk has been formatted. Each block can only hold one file of data, if the file is too large, will occupy multiple blocks, if the file is too small, the block remaining space can not be used, it will lead to wasted disk space , so after the disk partition, the file system before formatting, Think carefully about the expected usage of your file system .

Mediation Data (metadata)

These elements are designed to maintain the state of the file system, mainly representing the dynamic configuration information of the file system, which belongs to descriptive information.

  • Superblock (Super Block)
    Records the overall information of the file system (filesystem), including inode/block the total amount, usage, amount remaining, size, and file system format and related information.

    Note: The basic information of the whole file system is recorded in Superblock, its size is generally 1024Bytes, if it dies, it will take a lot of time to remedy Oh!!!

  • Block Group (block Group)
    Imagine, if our disk capacity of up to hundreds of G, when we format, Inode and block will be very large, in order to facilitate management, the Ext file system in the format, the introduction of the Block Group (block group) concept, each block group is maintained independent inode/block/ Superblock, with a fixed number of blocks, is divided into a group of the most basic sub-file systems.

    Note: Superblock is too important for file systems, but there is only one Superblock file system, so the subsequent block group may contain a backup superblock in addition to the first block group containing Superblock. The aim is to avoid the problem of Superblock single point of No rescue.

  • Block Bitmap (block table)
    A block can only be used by a single file, and when we add a file, we definitely need to use a new block to log the file data. So how quickly do you know which blocks are new? Which blocks are already in use? This is how block bitmap is designed to record all used and unused block numbers. Similarly, when we delete a file, we first find the corresponding block number from block bitmap, then update the flag as unused and finally release block.
  • Inode Bitmap (inode table)
    The same design concept as block bitmap, except that it is recorded as a used and unused inode number, which is no longer an AO statement.
  • Group Descriptor
    A block number describing the start and end of each section (block group), and a description of the block numbers between each section (Inodemap, Blockmap, Inode table), respectively.

List all the devices that are currently formatted for the system:blkid

Pick a well-formatted device and view the file system details:dumpe2fs /dev/vda1

Note: The above magic signature for 0xef53 indicates that our disk partition is a ext2 and Ext3 file system. Similar to the magic that starts with a file, you can determine the file type.

Summarize

The Ext family is the most extensive Linux support, the most complete file system, when we format the disk, we have planned all the inode/block/metadate and other data, so that the system can be used directly, no need for dynamic configuration, this is its best features, But this is also its most significant disadvantage, the larger the disk capacity, the slower the format, centos7.x has chosen XFS as the default file system.

Understanding the Linux Standard file system (EXT2/EXT3/EXT4)

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.