Pages

Bash Script: Monitor Inode Usage for UFS in Solaris 10

A file is the smallest unit of storage in the Unix file system (UFS). In Unix and Unix-like operating systems, each file is associated with an inode (Index Node) that stores the attributes like permissions, owner, group, size, type, time stamp, and etc. of file system objects like regular file, directory, and etc. Note that an inode contains all the information about a file except its name, which is kept in a directory. The size of an inode is 128 bytes. The inode allocation in UFS is static unlike XFS or NTFS that can easily cause lack of inodes if you have lot of small files. This makes the situation critical to place inode monitoring in place and do some trend analysis to prevent downtime. So here is a bash shell script to monitor the inode usage for UFS in Solaris 10. The script can send you the email notification if the inode usage goes over 90% and also logs the data in CSV format for tracking the growth. You need to run the script from cronjobs so that it can work even if you are not in front of your server.