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)
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)
I am kind of lost at that point. Am I missing something?
Hope you can guide me to a fix.
Thank you. Regards.
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!
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:
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
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
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:
- 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:
- sudo apt install ncdu
This will graphically represent your disk usage:
- 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!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.