This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article.
Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
Script for Checking Used Space in File Systems in the Solaris OS
Victor Feng, February 2008
As system administrators, one of our jobs is to keep an eye on the available space of systems. This article provides a script,
checkfsspace, which checks whether the used space for both UFS and ZFS file systems exceeds a
warning threshold. If the used space exceeds the threshold, the script sends a warning message to a specified email address. If you don't have ZFS (for example, on a system that runs the Solaris 9 OS), the script will skip checking ZFS.
Note: The checkfsspace script was tested on the Solaris 9 09/04 OS and
the Solaris 10 11/06 OS.
Here's the script source code. Please save the script
without the .txt suffix.
Then specify the values of the following variables in the checkfsspace script,
and run the script at a time when your system is not busy.
LOG, which specifies where to log warning messages
(<dir_of_checkfsspace>/fsspace_msg)
RECEIVER, which specifies the email address where warning messages will be sent
USED_SPACE_PERCENT_WARN, which specifies the used-space warning threshold; the default is
80 percent
The following demonstrates how checkfsspace reacts when the used space of some file systems
exceeds the warning threshold of 80 percent:
For this demonstration, here's information about the UFS file system: