On 18/07/2013 10:25, Bernhard Voelker wrote:
I have e.g. a file system where most of the inodes space is used,
let's say 450k of 500k. What command(s) would I use to find out
which sub-directories are eating most of the inodes?
Well, I could use something like this:
$ find . -xdev -type d \
| while read f ; do \
printf "%d %s: " "$(find "$f" -xdev | wc -l)" "$f" ; \
done \
| sort -k1,1n
But this a) is lame and b) doesn't count hardlinks well.
This gives the non-cumulative total per directory:
$ find . -xdev -printf '%h\n' | sort | uniq -c | sort -n
but doesn't handle hard links. You could use -printf '%h %i\n' and
post-process the duplicate inodes (no per-file stat since find v4.5.4).
Cheers,
Phil