Linux file Attribute description (Inode,block)

Source: Internet
Author: User
Tags egrep

1.ls-lhi

Text Explanation:

First column: Inode index node number (person's ID, national only)

When the system reads the file, it first finds the inode through the filename before it can read the file contents.

Second column: File type and permissions (a total of 10 characters, the first character is type, and the next 9 characters are file permissions)

Column three: Number of hard links (see the in command for details)

Column Fourth: The user to which the file or directory belongs (owner)

The existence of files and programs in Linux must have users and groups to meet the corresponding needs of existence.

Fifth column: The group to which the file or directory belongs

Sixth column: Size of the file or directory

No. 789 Column: The modified time of the file or directory; The default month day

Tenth column: Actual file or directory name

File name does not count as attributes

Different CentOS version inode sizes are different:

Dumpe2fs/dev/sda1|grep-i "Inode size" #<==/boot partition default 128

View File system Inode Total and amount remaining: Df-i

To see how much disk is used: df-h

Disk space is full, is determined by two parameters, the first one is the inode is full, the second block is full

A feature of disk full (no space on device left)

Summary of the Inode:

1. A certain number of inode and block are generated when the disk is formatted as a EXT4 file system by partitioning

2.inode is called an index node, which is used to store the file's attribute information and the index of the file (the entity that points to the file)

The block of the 3.ext3/ext4 file system holds the actual contents of the file

4.inode is a piece of storage space on disk, C6 non-boot partition inode default size 256 bytes, C5 is 128 bytes

The representation of 5.inode is a string of numbers, and the Inode (a string of numbers) corresponding to the file is unique within the file system.

6.inode node number of the same file, each other as a hard-link file, can be considered a different entry of a file

7.EXT3/EXT4 file system, a file is created to occupy at least one inode and one block; Normally a file occupies and occupies only one inode (person and ID)

8.block is used to store the actual data, each block size generally has 1k,2k,4k several. Where the boot partition, such as 1k, the other common partition is more than 4k (C6)

9. If a file is large (high-definition large 4G), may occupy multiple blocks, if the file is small (0.01K), at least one block, and the remaining space of this block is wasted, that can no longer store other data

10.inode size and Total view

1) dumpe2fs/dev/sda1|egrep-i "Block Size | Inode size "

2) dumpe2fs/dev/sda1|egrep-i "Block Count | Inode Count "

The default block count is typically greater than the number of Inode count

11. View the total inode volume and usage: df-i

12. View the inode information for a file method: Ls-li or Stat/etc/hosts

13. How to generate and specify Inode size

Format command: Mkfs.ext4-b 2048-l 256/dev/sdb

A summary of knowledge about block

1. Disk read data is read per block

2. A file may occupy multiple blocks. But the disk I/O is consumed once every blcok is read

3. If you want to improve disk IO performance, then try to read as much data as possible at once

4. A block can only hold the contents of one file, no matter how small the content. If the block defaults to 4K size, then storing a 1K file, the remaining 3K will not be able to store other files, can only waste

5.Block is not the bigger the better. Block is too large for storing small files will waste disk space, for example: 1000K file, Block 4K, occupy 250 blocks, if the block default is 1 K, you need to occupy 1000 blocks. Who is more efficient to access? Consumes IO 250 and 1000 times respectively

6. According to business requirements, confirm the default block size, if it is large file (greater than 16K) general settings block larger, small files (less than 1K) general settings block smaller

7.block is too large, for example 4 K, files are 0.1K, a lot of wasted disk space, but high access performance

8.block is too small, such as 1K, files are 1000K, consuming a lot of disk IO

9.blcok Size setting is also determined when formatting the partition, command mkfs.ext4-b 2048-i 256/dev/sdb

10. Enterprise files will be relatively large (generally more than 4K), block setting larger will improve disk access efficiency

11.EXT3/EXT4 file System (CENTOS5 and 6), typically set to 4K

Summary of the total:

1. When the disk is partitioned into a file system, it will be divided into inode and block two parts.

2.inode the properties of the stored file and pointers to the file entity, the filename is not in the inode, usually in the upper directory block

3. Access the file, the principle through the file name-->inode-->block

Linux file Attribute description (Inode,block)

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.