Running out of space on OS X is bad, like real bad.
Read on to find out more about the built-in facilities that will prevent you from running out of space.
The following information is based off of OS X Server 10.3.5
OS X Server comes with a utility called diskspacemonitor. This is a configurable, cron-activated commandline tool that resides in /usr/sbin/diskspacemonitor. It is designed to periodically monitor the amount of free space on disks and execute pre-configured actions when thresholds are reached.
This tutorial provides a brief introduction to this utility.
There are several configuration files used by diskspacemonitor. If you check the /etc/diskspacemonitor/ directory you’ll find the default files installed with OS X Server. Do not edit the .default files. Copies will be made for the appropriate configuration file when the diskspacemonitor utility is activated.
[X:/etc/diskspacemonitor/] username$ ls -1F
By default, the action directory contains two scripts: alert and recover. Both of these shell scripts can be configured using the respective file: alert.conf and recover.conf.
This is the default configuration file used for the alert script found at /etc/diskspacemonitor/action/alert. The three configurable variables are: subject, to, and body. These correspond with the email that is sent out by the alert script when the warning threshold is reached.
# Config for alert
# Arguments passed to alert (and alert.local, if
# it exists):
# - Volume name
# - Threshold
# - Percentage full
# - Log file
subject="DiskSpaceMonitor: Disk $1 has exceeded $2% threshold, is $3% full."
body=`df -k -l -t ufs; df -k -l -t hfs`
Notice that the body variable contains the output of the df command. WARNING: When tested on OS X Server 10.3.5 the df command above will fail with the following error: df: -l and -t are mutually exclusive. After enabling diskspacemonitor, edit the alert.conf file by deleting the “-l”. For more information on df see the man page.
This is the main configuration file used by diskspacemonitor. The four configurable variables are: monitor_interval, alert_threshold, recovery_threshold, and log_file. See the output for descriptions of these variables.
# Config for diskspacemonitor
monitor_interval=10 # Check disks at this interval, in minutes
alert_threshold=75 # When a disk is this percentage full, execute
# the alert scripts in
recovery_threshold=85 # When a disk is this percentage full, execute
# the recovery scripts in
This is the configuration file used by /etc/periodic/600.daily.server, which is a log-rolling script installed by default with OS X Server. I do not recommend editing this config file unless you know what you’re doing.
This is the configuration file for the recover script located in /etc/diskspacemonitor/action/. It defines what log files to roll or compress. Do not edit this file unless you know what you’re doing.
As of OS X Server 10.3.5 the following files don’t do anything: