Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Today, I ran out of inodes on one of my VPSs.
I deleted a bunch of superfluous small files, freeing enough inodes to make the system operational again:

Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/simfs       586K  529K   58K   91% /

I also hacked together a short command to give me the number of used inodes (essentially listing all files with their inode numbers, filtering out duplicates and counting the lines of the result):

sudo find / -xdev -type f -printf '%i~%P\n' > files.txt
<files.txt | sort -u -t'~' -k1,1 > inodes.txt
wc -l files.txt inodes.txt
1513608 files.txt  
275320 inodes.txt

So it looks like the files on / only account for 275k inodes, but df reports 529k used.

How can that be?

(I even restarted the system to free any inodes that were still locked by processes, but that didn't change the amount of used inodes at all.)

share|improve this question
directories have also inodes, try again w/o -type f – user55518 Mar 27 '14 at 21:48
up vote 2 down vote accepted

Use a bind mount instead of -xdev. Also, directories use inodes too.

mkdir /mnt/somewhere
mount -o bind / /mnt/somewhere
find /mnt/somewhere -printf '%i\n' | sort -u | wc -l
share|improve this answer
Curious about the -xdev suggestion. Why is that? – Bratchley Mar 27 '14 at 21:48
@JoelDavis Probably to make sure there aren't files hidden under a mount point. – derobert Mar 27 '14 at 22:11
Options like -xdev, --one-file-system, etc. never give the complete picture. You should never use them on principle if you can help it. – frostschutz Mar 27 '14 at 22:59
I used -xdev to exclude files on mountpoints like /tmp. However I didn't think of mountpoints "shadowing" files on the rootfs, so thanks for the hint to use a bind mount. – n.st Mar 29 '14 at 14:14

Your Answer


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.