Analysis of the possibility that the hard disk can not write files, this time inode occupies 100%

 Watson Blog April 13, 2019 13:16:43 The server comment one hundred and fifty-five Reading mode

The problem this time is a tp5 site, which prompts 404. According to past experience, the file in the Runtime is not successfully written.

Fault analysis: When executing df - h, it is found that the space occupied is less than 70%. When executing df - hi, it is found that the IUse% value of a partition is 100%, indicating that the inode has been used up. It should be caused by a large number of small files in some directories.

terms of settlement:

There are two possibilities for the distribution of a large number of small files. One is that there are a large number of small files in only one or a few directories. In this case, we can use the following command to find the abnormal directory:
find / -type d -size +10M
This command is used to find out the directory whose size is greater than 10M (the larger the directory size, the more files in the directory).
The second possibility is that a large number of small files are distributed in a large number of directories. At this time, the above command may not find an abnormal directory. The following command is required:
cd /
find */ ! -type l | cut -d / -f 1 | uniq -c
This command is used to find out the total number of files in the directory. It may need to be executed several times until a specific directory is found. For example, the above command finds that there are a large number of small files in the/data directory, but there are many directories in the/data/directory. At this time, we need to continue to execute:
cd /data
find */ ! -type l | cut -d / -f 1 | uniq -c
Until you find the specific directory.

If you can directly delete a folder full of nodes:
find . -type f -exec rm {} \;
You can also delete files according to their inode nodes
find . -inum 342137 -exec rm -i {} \;

Finally, the problem is solved. To sum up, the hard disk cannot be written to the following types of problems:
1. No permission
2. When the hard disk is full, you can df - h or a directory du - h to see the value
3. The lnode is 100%. It should be deleted.

 Watson Blog
  • This article is written by Published on April 13, 2019 13:16:43
  • This article is collected and sorted by the website of Mutual Benefit, and the email address for problem feedback is: wosnnet@foxmail.com , please keep the link of this article for reprinting: https://wosn.net/1691.html

Comment