Linux file access process and disk Inode and block summary

Source: Internet
Author: User
Tags parent directory

Linux file access process

The inode is the unique identifier of the file, and the file name and inode correspondence are stored in the block at the previous level of the directory, and the inode has pointers to the file block and attributes of the file, thereby obtaining data from the block.

The capacity of the disk is determined by both Inode and block

The disk space is full and is determined by two parameters:

The first is whether the inode is full, the second is whether the block is full, and no one is full to save the data.

A summary of the Inode
    1. Disk format a certain number of inode and block are generated when the file system is created;
    2. The inode is called an index node, which is the property information of the file and the pointer to the block;
    3. The inode is a piece of storage space on disk, CentOS6 default inode size is 256 bytes;
    4. The inode number is unique, and the different files have a unique inode number;
    5. Files with the same inode number are hard links to each other;
    6. Create a file to occupy at least one inode and one block;
    7. View the total inode volume and usage df-i;
    8. View the inode information for a file ls-li or stat/etc/hosts;
    9. Generates an inode mkfs.ext4-b 2048-i 256/dev/sdb of the specified size.
A summary of the block
    1. The disk access file is accessed in block-based units;
    2. A file may occupy more than one block, but it consumes disk I/O every time a block is read;
    3. If you want to improve disk IO performance, the block should be larger so that more content can be read;
    4. Block is too large, storing small files will cause space waste, block is too small, it will consume disk IO;
    5. To determine the block size according to business requirements, the general default setting is 4K;
    6. The block size is also determined when the format is formatted, and the command is Mkfs.ext4-b 2048-i 256/dev/sdb.
Overall
    1. After the disk format file system, it will be divided into inode and block two parts;
    2. The inode holds the file attributes and pointers to the block;
    3. The file name and inode correspondence are stored in the parent directory block;
    4. Inode default 256b,block default 4K;
    5. View inode number and usage through df-i;
    6. View Inode and block size dumpe2fs/dev/sda1 | Egrep "Inode size| Block size ";
    7. A file occupies at least one inode and block, and a hard link occupies the same inode;
    8. A block can only be used by a file, block is too small, poor performance, block is too large, wasting space;
    9. Usually, how many files can be placed in a space depends on the number and size of the inode and block, and if the file is small, the block or inode is easy to run out, and if the file is large, the number of blocks should be divided by the number of block used by a file.

Linux file access process and disk Inode and block summary

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.