How to find the number of files on a filesystem?

For some reason df -h command shows that you have plenty of free space. However your apps keep telling you that you don’t have enough free space. The following will help you identify the problem.

The –inodes option to df will tell you how many inodes are reserved for use. For example:
df --inodes /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/mapper/root
989296 977987 11309 99% /
find / -xdev -print | wc -l
859714

Notice that the number of entries returned from find is lower than IUsed for the root (/) filesystem.

Remember that directories, symlinks, UNIX domain sockets and named pipes are all ‘files’ as it relates to the filesystem. So using find -type f flag is wildly inaccurate, from a statistical viewpoint.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.