How to get inode count of a filesystem on Solaris/Unix? How to get inode count of a filesystem on Solaris/Unix? unix unix

How to get inode count of a filesystem on Solaris/Unix?


The statvfs system call can be used to retrieve file system statistics including the number of total inodes and the number of free inodes. Use the system call to retrieve a statvfs structure and then inspect the f_files and f_ffree fields to determine the number of inodes and the number of free inodes, respectively.

Example:

#include <statvfs.h>struct statvfs buffer;int            status;fsfilcnt_t     total_inodes;fsfilcnt_t     free_inodes;...status = statvfs("/home/betaylor/file_in_filesystem", &buffer);total_inodes = buffer.f_files;free_inodes  = buffer.f_ffree;...