linux No space left on device 500 error caused by inode fullness

linux No space left on device 500 error caused by inode fullness

What is an inode?

To understand inode, we must start with file storage.

Files are stored on the hard disk, and the smallest storage unit of the hard disk is called a "sector". Each sector stores 512 bytes (equivalent to 0.5KB).

When the operating system reads the hard disk, it does not read it sector by sector, which is too inefficient. Instead, it reads multiple sectors continuously at one time, that is, it reads a "block" at a time. <br>This "block" composed of multiple sectors is the smallest unit of file access. The most common "block" size is 4KB, that is, eight consecutive sectors form a block.

File data is stored in "blocks", so obviously we must also find a place to store the file's metadata, such as the creator of the file, the creation date of the file, the size of the file, and so on. <br>This area for storing file metadata is called inode, which is translated into "index node" in Chinese.

Recently, the website editor reported that uploading pictures failed and the website pages often had 500 errors.

For general 500 errors, I searched https://www.jb51.net/article/175431.htm and found that the configuration was fine.

Checked the nginx error log and found that the disk space was full

I checked the disk usage with the df -h command and found that there was still some space left.

Problem found: Later, I checked the index node (inode) with df -i and found that it was full (IUsed=100%), which made the system unable to create new directories and files.

Solution: Delete useless temporary files and release inodes.

You can see that there are many temporary files in the /tmp directory.

You can also choose the /var/spool/ directory

Enter the following command to view the number of files under /var/spool/

for i in /var/spool/; do echo $i; find $i |wc -l|sort -nr; done

See there are more than 2 million files

cd /var/spool/clientmqueue/ Enter this directory, delete these useless files, check, there are 600,000 files, there are too many files,

So I used this command:

ls | xargs rm -rf

2 or this command

find . -name "*" | xargs rm -rf

The files can be deleted in batches. The following figure shows the effect after deletion: inode usage is 21%. alright

It is because the junk files have not been cleaned for a long time that it takes too much time to clean the files. In order to avoid such problems, it is best to clean the system's junk files regularly or deploy a monitoring system.

You can temporarily transfer some files to a directory that occupies less disk space based on the file occupancy of the larger directory.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of Linux index node inode
  • Linux Network Setup Details
  • How to use MyCat to implement MySQL master-slave read-write separation in Linux
  • Hidden overhead of Unix/Linux forks
  • Learning about UDP in Linux
  • Linux swap partition (detailed explanation)
  • C++ Network Programming under Linux epoll technology and IOCP model under Windows
  • How many ports can a Linux server open at most?
  • Details of Linux file descriptors, file pointers, and inodes

<<:  Basic concepts and common methods of Map mapping in ECMAScript6

>>:  A brief discussion of four commonly used storage engines in MySQL

Recommend

Example code for achieving hollowing effect with pure CSS

I have recently studied the hollowing effect. bac...

Detailed explanation of the role of key in React

Table of contents Question: When the button is cl...

Using js to achieve waterfall effect

This article example shares the specific code of ...

How to use Nginx to solve front-end cross-domain problems

Preface When developing static pages, such as Vue...

Specific use of Node.js package manager npm

Table of contents Purpose npm init and package.js...

Native js to implement form validation function

Table of contents When developing, analyzing the ...

Briefly understand the MYSQL database optimization stage

introduction Have you ever encountered a situatio...

Interaction in web design: A brief discussion on paging issues

Function: Jump to the previous page or the next p...

vue.js Router nested routes

Preface: Sometimes in a route, the main part is t...

Linux CentOS6.9 installation graphic tutorial under VMware

As a technical novice, I am recording the process...

Server stress testing concepts and methods (TPS/concurrency)

Table of contents 1 Indicators in stress testing ...

Detailed explanation of how to use Node.js to implement hot reload page

Preface Not long ago, I combined browser-sync+gul...

Install MySQL5.5 database in CentOS7 environment

Table of contents 1. Check whether MySQL has been...