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

Today I encountered a very strange li a click problem and solved it myself

...It's like this, today I was going to make a...

How to prohibit vsftpd users from logging in through ssh

Preface vsftp is an easy-to-use and secure ftp se...

Simple example of using Docker container

Table of contents 1. Pull the image 2. Run the im...

Code for aligning form checkbox and radio text

Alignment issues like type="radio" and t...

How to use @media in mobile adaptive styles

General mobile phone style: @media all and (orien...

Detailed explanation of mixed inheritance in Vue

Table of contents The effect of mixed inheritance...

Summary of things to pay attention to in the footer of a web page

Lots of links You’ve no doubt seen a lot of sites ...

14 practical experiences on reducing SCSS style code by 50%

Preface Sass is an extension of the CSS3 language...

How to install MySQL 8.0 in Docker

Environment: MacOS_Cetalina_10.15.1, Mysql8.0.18,...

JS gets the position of the nth occurrence of a specified string in a string

Learn about similar methods for getting character...

Tutorial on installing mysql5.7.23 on Ubuntu 18.04

This article shares with you the specific method ...

Sample code for highlighting search keywords in WeChat mini program

1. Introduction When you encounter a requirement ...

JavaScript Basics Operators

Table of contents 1. Operators Summarize 1. Opera...