2

This question already has an answer here:

I'm using Ubuntu 14.x, and recently attempting to create files failed with some kind of disk is full message.

I had more than 2gb spaces and that's not possible, but I heard that it can causes if inode is full.

I'm not skilled linux user, so I don't get it how to remove them. First what I do was typing this above command as root to see how many inodes were used:

$ df -i -h
Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             248K   414  248K    1% /dev
tmpfs            250K   467  250K    1% /run
/dev/xvda1       512K  512K     0  100% /

Yeah, it's 100%. Then I found the command that shows how much inodes were used in current system:

#  for i in /*; do echo $i; find $i |wc -l; done

It prints this:

/bin
172
/boot
353
/dev
416
/etc
1971
/home
21808
/lib
17720
/proc
43272
/sys
36453
/tmp
5134
/usr
423458
/var
10117
...

So I deleted some files in /home/dev, and I got some free inodes back, but not much:

Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/xvda1       512K  464K   49K   91% /

Besides, when I re-install the files that I needed, it takes inodes again, so this actually not solved.

I saw that /usr directory takes almost of inodes: 423458, but I don't know which files can I remove that doesn't affect other system or programs.

How do I find "unnessecary" inodes to delete? Any advice will very appreciate it.

marked as duplicate by Jeff Schaller, Stephen Rauch, Philippos, Archemar, njsg Sep 6 '17 at 15:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Show output of command: find /usr/ -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | tail – Egor Vasilyev Sep 6 '17 at 8:53
  • You have too many files. – Satō Katsura Sep 6 '17 at 10:40
  • When this sort of problem, the file system is normally populated with a large number of tiny files. If this a recent issue, then you can find files in the file system based on date and size. – Raman Sailopal Sep 6 '17 at 11:04
  • 1
    "unnecessary" is hard to answer, but see the linked question for ways to find where those files are – Jeff Schaller Sep 6 '17 at 13:24
  • This can be because of linux kernel image and headers taking up a lot of the inodes.Check this ubuntuhandbook.org/index.php/2016/05/… – whokares Mar 24 '18 at 17:18
0

Comparing to my system you have a lot of files in /usr, so I would suggest continuing the search there, if you just change /* to * in the command it will work in any directory. If you don't have anything to compare the numbers with it might become difficult though. Here's the count of files I have in the subdirectories of /usr:

bin 2397
games 32
include 4607
lib 27379
local 34
sbin 271
share 1
src 22971

(made with for i in *; do echo -n "$i "; find $i |wc -l; done)

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