Command Used to test Inode usage in Linux

Source: Internet
Author: User
Tags inode usage
Article Title: process command for testing Inode usage in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

In a Linux/Unix like OS file system, the node in each directory tree does not directly contain the file information as in Windows, but only contains the file name and Inode number. the Inode node corresponding to the file name is found through the Inode number, and the actual metadata such as the file size, physical address, owner, access permission, timestamp, and number of hard links are truly recorded. therefore, you can use hard link in Linux to create countless file names in different directories for a file, while the actual file data only needs to be copied.

But because of the structure of this file system, when you perform IO operations in Linux, the required resources need to have the remaining Inode in addition to the disk space. By default, Linux calculates the maximum number of Inode entries for each partition based on 2 k disk space corresponding to one Inode during system installation. After a file system is created, the number of Inode available for each partition cannot be dynamically adjusted. Normally, the Inode of a partition is not used up and the disk space is still insufficient, unless the small junk files that I have encountered are too long to be effectively cleaned up. However, if necessary, you can create a file system (such as using mke2fs) adjust this parameter as needed (for example, if the partition is used to store ultra-large video files, the Inode quantity can be smaller; if you want to store a large number of mini files smaller than 2 kb, consider creating more Inode ).

Run the df-I command to view the total inode count, used, and idle inode count of each partition.

First, we will test the Inode usage: first find a K file (test. log), and then use the following command to split it into several small files:

Split-a 10-B 1 test. log z

If you repeat the preceding operations multiple times, all Inode is occupied. In this case, although df-k can be used to view the remaining space in the system, it is impossible to create a new file because Inode cannot be allocated.

You can use the following command to delete these large numbers of small files:

Find ~ -Name "*. log" | xargs-L rm

Note that you cannot directly Delete objects by using the rm command, because the rm command passes the deleted objects as one parameter after another. When there are too many deleted objects, the following error message is displayed: arg list too long

When Inode is exhausted, Oracle listening process startup errors may also occur.

Related Article

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.