Question

Issue clearing / finding Inodes usage

Hi, my Linux knowledge is limited, hope you can help me. My Ubuntu server is running into the following error regarding disk usage: “Deploy failed: {“code”:“ENOSPC”,“message”:“ENOSPC: no space left on device, open ‘/home/nred/.node-red/flows.json.$$$’”}”

After some troubleshooting, it seems this is related to having 100% Inodes usage. (See below) image alt text

I found the following post regarding how to find Inodes but i run into issues when following the steps. https://www.digitalocean.com/community/questions/best-way-to-clear-inodes

Using the command: “for i in /*; do echo $i; find $i |wc -l; done” I was able to narrow it down to /home using 3081197 Inodes.

After I followed the trail to: “for i in /home/*; do echo $i; find $i |wc -l; done” Which in turns gave me /home/nred using 3081196 Inodes which is fine so far.

Onto next step using “for i in /home/nred/*; do echo $i; find $i |wc -l; done” It only returns 4 files and 1 folder using 6307 Inodes. (See below)

image alt text
image caption

I am kind of lost at that point. Am I missing something?

Hope you can guide me to a fix.

Thank you. Regards.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 15, 2024
Accepted Answer

Hi there,

Based on the output that you’ve shared it looks like that all of the inodes are used by the /home/nred/ directory itself.

You can do a quick count to verify if this is the case:

ls -la /home/nred/ | wc

If this is not the case, check for hidden files:

for i in /home/nred/.* /home/nred/*; do echo $i; find $i | wc -l; done

I personally prefer the find command instead of doing this with a for loop:

find /home/nred -xdev -type d -print | while read dir; do echo -n "$dir: "; find "$dir" -type f | wc -l; done | sort -n -k2

Once you identify the directories with high inode usage, you can look for unnecessary files to delete. Common culprits include:

  • Temporary files
  • Log files
  • Cache files

If you identify a particular type of file that consumes a lot of inodes and is not necessary (e.g., cache files), you can clear it up with the following command which will delete files that are older than 30 days:

find /home/nred/.cache -type f -mtime +30 -delete

Let me know how it goes!

Best,

Bobby

alexdo
Site Moderator
Site Moderator badge
May 16, 2024

Heya,

If the problem persist and it’s not related only to the php session files, you can expand the search and check the disk space usage in other directories as well.

You can check which folders are using the most space on the Droplet by using the disk utilization command, du:

  1. du -h --max-depth=1 /

Check our tutorial on How to fix disk space issues here:

https://docs.digitalocean.com/support/how-do-i-fix-disk-space-issues-on-my-droplet/

There is also an ncurses interface for du, appropriately called ncdu, that you can install:

  1. sudo apt install ncdu

This will graphically represent your disk usage:

  1. ncdu
Output--- /root ----------------------------------------------------------------------
    8.0KiB [##########] /.ssh
    4.0KiB [#####     ] /.cache
    4.0KiB [#####     ]  .bashrc
    4.0KiB [#####     ]  .profile
    4.0KiB [#####     ]  .bash_history

You can step through the filesystem by using the up and down arrows and pressing Enter on any directory entry.

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
May 16, 2024

Heya @19287c7d001a4449b78784e124069a,

It does seem like the issue comes from /home/nred/. Usually what fills up the inodes is actual files like a session or something similar that get’s generated automatically by something.

As for finding the Inodes, can you try using find, it suits the case a lot better. Something like the following should do the trick

find /home/nred -xdev -type d -print | while read dir; do echo -n "$dir: "; find "$dir" -type f | wc -l; done | sort -n -k2

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel