Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it simply because going from filenames to inode numbers is difficult in userspace, and you can't read inodes from there?

share|improve this question

migrated from stackoverflow.com Dec 15 '11 at 7:37

This question came from our site for professional and enthusiast programmers.

    
The answer is twofold, I think. It's not available in general because, as suggested, a normal user can't go reading inodes arbitrarily. It's not available as a tool requiring root access because there's no easy, reliable way to go from filenames to inode numbers outside the kernel. –  nick black Dec 14 '11 at 9:03
    
Better off on unix.stackexchange.com –  Chris J Dec 14 '11 at 9:04

2 Answers 2

Use df, not du!

du stands for "disk usage". It is df which stands for "disk free" and will check the filesystem proper. Including inode usage with the -i option!

Otherwise, just do:

find thedirectory -exec ls -di {} \;|awk '{print $1}'|sort|uniq|wc -c

or similar

share|improve this answer
    
No, I want a hierarchal summary of the inode usage from a given root. I know what tool I'm talking about. –  nick black Dec 14 '11 at 9:00
    
but why, why do you think he wants to measure file system disk space usage? –  Oleg Mikheev Dec 14 '11 at 9:02
    
find|wc -l, then... Of course you'll need to account for files with multiple links. But your question doesn't really make any sense. –  fge Dec 14 '11 at 9:03
    
@Oleg, I didn't say this at all. df has a -i option. –  fge Dec 14 '11 at 9:04

GNU coreutils' implementation of du(1) will support the --inodes option with the next release (>8.21) ... I've just pushed the patch to upstream Git (http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=333dc83d). See http://lists.gnu.org/archive/html/coreutils/2013-07/msg00087.html

share|improve this answer

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.