Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I cannot update Ubuntu because I have 99% inode usage. What is the easiest way for me to alleviate this problem?

Thanks for your help.

share|improve this question
2  
A very similar question was asked on StackOverlow. Maybe that will help stackoverflow.com/questions/653096/howto-free-inode-usage –  Chris Wilson Dec 22 '12 at 1:18
1  
And ServerFault serverfault.com/questions/185553/… –  Chris Wilson Dec 22 '12 at 1:18

2 Answers 2

up vote 6 down vote accepted

The number of inodes is set at the time the partition is formatted. Normally the number of inodes created is sufficient for almost any purpose; however, if you have a great number of very small files then you can use up the inodes before the disk is full.

You need to find the many thousands of small files you have on the system that are using up inodes and either delete them, or move them to a partition that has been specifically set up with a very large number of inodes available. It is not possible to change the number of inodes available on a partition after it has been formatted.

The script written by paxdiablo on stackoverflow might be handy way to check for excessive small file use that you may not be aware of. Here it is again:

#!/bin/bash
# count_em - count files in all subdirectories under current directory.
echo 'echo $(ls -a "$1" | wc -l) $1' >/tmp/count_em_$$
chmod 700 /tmp/count_em_$$
find . -mount -type d -print0 | xargs -0 -n1 /tmp/count_em_$$ | sort -n
rm -f /tmp/count_em_$$

Put this script in the text file ~/bin/count_em and then issue the command

chmod +x ~/bin/count_em

to make it executable. If you had to make the directory ~/bin then it won't be in the executable path yet, so just log out and back in again.

To run the program you just type

count_em

and it will list the numbers of all files in the current directory and subdirectories by directory, with the highest count last. Very handy!

share|improve this answer
    
THIS LINE > chmode +x ~/bin/count_em is actually > chmod +x ~/bin/count_em –  user169677 Jun 23 '13 at 20:15
    
is it necessary to delete all of those user-created files, or will moving them into tar archive do the trick? –  amc Jun 23 '13 at 20:18
    
Archiving them is a great way to deal with it, it doesn't delete users data but makes them aware that their behaviour isn't satisfactory as they wont be able to use the files as they were previously. Chances are though that the huge number of files is generated by something no one is using and they could be safely deleted, but that is a risk. –  LovesTha Jul 23 at 0:06

I found that the inode usage was coming from /root/.local, and deleted that folder.

share|improve this answer
    
Nothing much should be using /root/.local and it's only there for compatibility reasons. You need to find out what was writing many tiny files to this directory. –  fabricator4 Dec 22 '12 at 4:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.