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.

I encourage you to please download the script from GitHub and give it try and don't hesitate to make a comment on this post if you have any issue or some suggestions to improve the script.

You can check the script here:


You should change the email address for your notification in the script and space separated multiple email addresses can defined. If you want to exclude some of the partitions then update the EXCLUDE_LIST variable and "|" (pipe) separated multiple partitions can be defined. Also, the default path to save the CSV file is /tmp/inode_usage_data.csv but if you want to change that then simply update the INODE_USAGE_DATA variable.

In a UFS volume, Inodes are numbered sequentially, starting at 0. The first two inodes are reserved for historical reasons, followed by the inode for the root directory, which is always inode 2. - Wikipedia

Any feedback will be highly appreciated.

Suggested Posts,

This post appeared on the by Sumit Goel. Copyright © 2012–2013 – and Sumit Goel. All rights reserved. Not to be reproduced for commercial purposes without written permission.

No comments:

Post a Comment

Be sure to check back again because I do make every effort to reply to your comments here.