The key knowledge summary of Inode and block

Source: Internet
Author: User
Tags egrep

1. View the block size of the disk partition under/DEV/SDA1:


2. View individual inode and block sizes:


3. Knowledge about the Inode:

Attribute information for Inode users:

① Index on the home page is equivalent to the inode;

② Each page is a block;

③ the whole book is a disk or partition.


"Df-i view mounted disks, inode situation"

About the Inode summary: Learn the stages of knowledge, do a summary is to learn the good Linux operation and maintenance habits:

(1) A certain number of inode and block are generated when the disk partition is formatted as a EXT4 file system;

(2) The inode is an index node that is used to hold the file's attribute information and the index of the file, which points to the file's entity->block;

(3) The block of EXT3/EXT4 file system holds the actual contents of the file;

(4) The inode is a piece of storage space, the default size byte of the CENTOS6 partition Inode is 256 bytes, and the Centos5 is 128 bytes;

(5) The inode is a string of numbers, and the inode (a bunch of numbers) corresponding to different files is unique in the file system;

(6) If a file is large, it may occupy multiple blocks, if a file is small, at least one, and the remaining space wasted;

(7) The same documents for the Inode, each hard linked file;

(8) A file is created to occupy at least one inode and one block;

(9) If the file is small, it must occupy at least one block and the remaining space can not be used;

(a) Inode size and total view:

Dumpe2fs/dev/sda2|egrep-i "Block size| Inode Size "

Dumpe2fs/dev/sda3|egrep-i "Block count| Inode Count "

(11) View the total number of inode and Usage command: df-i:


4. Knowledge about BLOCK:

(1) The disk Blck read data is read by block unit;

(2) A file may occupy multiple blocks, each reading a block will consume a disk IO;

(3) If you want to improve the performance of the disk, it is necessary to read as much as possible the number of data is enough;

(4) A block can only hold the contents of a file, regardless of how small the content. If the block size is 4k, then the storage of 1K files, the remaining 3K is wasted;

(5) block is not the larger the better, block too large for small file storage will waste disk space;

For example: 1000K file, block for 4K, occupy 250 blocks;

Block is 1 K and occupies 1000 blocks.

Consumption disk IO is: 1000 times and 250 times, who is more efficient.

(6) Large file (greater than 16K) general settings block a bit larger;

Small file (less than 16K) generally set block smaller.

(7) Blcok is too large, such as 4 K, files are 0.1K, a lot of waste of disk space

(8) block is too small, such as 1K, files are 1000K, disk IO consumption

(9) The block setting is also a disk partition when:

Mkfs.ext4-b 2048-1 2056/dev/sdb

(10) When the file is large, larger block settings will improve disk efficiency;

(one)/EXT3/EXT4 is generally set to 4K.


5. Enterprise Face Test

① a 100M (100000K) file partition, write 1K files and write 1M files, how many can be written respectively.

answer the idea:

A.inode is the file attribute information, the default size of 128byte (C58), 256byte (C64);

B.block is the content of the file, the default size of 1K (boot zone) or 4 K-system partition;

C. A document must occupy at least one inode and one block;

d. Default partitioning in general, the number of inode is sufficient and the block quantity is faster.

correct answer:

1. The default partition under normal circumstances, for large files, the inode is enough, and block number will be consumed faster, block for 4K, 1M files will not have disk waste, so the number of files is probably 100/1=100;

2. For small files 0.1k,inode will consume faster, the default partition, the number of blocks is greater than the number of inode, each file will occupy an inode and a block, so the number of final files: The inode will be consumed, the total number of files is the amount of inode.


② If you write data to the disk, you are prompted: no spaces left on device, viewing disk space through df-h, and finding that it is not full, why.

A. The inode may be depleted;

B.df-i See if the number of inode is exhausted;

c. Temporary mail queue/var/spool/clientmquene directory in enterprise work only the SendMail service is installed and is a temporary queue for sendmail messages. Centos5.8 default will be installed sendmail,centos6.6 default is not sendmail.


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.