Linux inode full workaround

Source: Internet
Author: User
Tags tmp file inode usage

Today , a login server Web site found that login did not generate a session. Based on past experience, it is generally because the space is full that the session file generation failed.

Df-hfilesystem                    Size  used Avail use% mounted on/dev/mapper/dev01-root         75G   58G   14G  82%/udev                          2.0G  4.0K  2.0G   1%/devtmpfs                         396M  292K  396M   1%/runnone                          5.0M     0  5.0M   0%/run/locknone                          2.0G  4.0K  2.0G   1%/run/shm/dev/sda1                     228M  149M   68M  69%/boot


Space remaining 14G, you can exclude the situation is full of space. Another reason for file generation failure is that the file index node Inode is full.

Df-ifilesystem                    inodes   iused  IFree iuse% mounted on/dev/mapper/dev01-root 4964352 4964352      0  100%/udev                          503779     503339    1%/devtmpfs                         506183     353 505830    1%/runnone                          506183       5 506178    1%/run/locknone                          506183       2 506181    1%/run/shm/dev/sda1                     124496     255 124241    1%/boot


Inodes occupies 100%, which is indeed the problem.

Workaround: Delete the unused temporary files and release the Inode.

Find a session temp file that has many sess_xxxxx in the/tmp directory.

ls-lt/tmp | wc-l4011517


Enter/tmp directory, execute find-exec command

sudo find/tmp-type f-exec rm {} \;


If you use RM *, there may be a Argument list too long error due to too many files, for Argument list too long error can refer to "Linux Argument list too long error resolution"

In addition to the TEMP. tmp file, the 0-byte file will also occupy the inode and should be freed.

Traverse looking for 0 bytes of file and delete.

sudo find/home-type f-size 0-exec rm {} \;


After deletion, the inode usage is reduced to 19% and can be used normally.

Df-ifilesystem                    inodes  iused   IFree iuse% mounted on/dev/mapper/dev01-root       4964352 940835 4023517   19%/udev                          503779  503339    1%/devtmpfs                         506183    353  505830    1%/runnone                          506183      5  506178    1%/run/locknone                          506183      2  506181    1%/run/shm/dev/sda1                     124496    255  124241    1%/boot









=================================================================================================


When you create a new file, you are prompted to no space left. In fact, with DF, there is space left.

However, when viewed with df-i, it is found that the inode is used up and the usage rate is 100%.

So you can't create a new file, but you can append the contents of a file.

The situation is occurring in the/var partition, which is manually looked up, is too many files in the/var/spool/clientmqueue:

[[email protected] clientmqueue]# ls | Wc-w

256210

[Email protected] clientmqueue]# Rm-f *

-bash:/bin/rm:argument list too long

[[email protected] clientmqueue]# for i in ' ls '; Do rm-f $i; Done

It took several minutes to delete more than 40,000 files,

or directly delete the Clientmqueue directory, much faster. Build this directory again and restore the corresponding properties.

Linux inode full workaround

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.