21.5. Monitoring the Local Disk for Graceful Shutdown

When the disk space available on a system becomes too small, the Directory Server process (slapd) crashes. Any abrupt shutdown runs the risk of corrupting the database or losing directory data.
It is possible to monitor the disk space available to the slapd process. A disk monitoring thread is enabled using the nsslapd-disk-monitoring configuration attribute. This creates a monitoring thread that wakes every ten (10) seconds to check for available disk space in certain areas.
If the disk space approaches a defined threshold, then the slapd begins a series of steps (by default) to reduce the amount of disk space it is consuming:
  • Verbose logging is disabled.
  • Access logging and error logging are disabled.
  • Rotated (archived) logs are deleted.

Note

Error log messages are always recorded, even when other changes are made to the logging configuration.
If the available disk space continues to drop to half of the configured threshold, then the slapd begins a graceful shut down process (within a grace period); and if the available disk space ever drops to 4KB, then the slapd process shuts down immediately. If the disk space is freed up, then the shutdown process is aborted, and all of the previously disabled log settings are re-enabled.
By default, the monitoring thread checks the configuration, transaction log, and database directories. If you additionally set the nsslapd-disk-monitoring-logging-critical parameter, monitoring also includes the log directory when evaluating disk space.
Disk monitoring is controlled by the following configuration parameters in the cn=config entry:
  • nsslapd-disk-monitoring
  • nsslapd-disk-monitoring-grace-period
  • nsslapd-disk-monitoring-logging-critical
  • nsslapd-disk-monitoring-threshold
To enable and configure disk monitoring:
  1. Use the dsconf config replace command to add the disk monitoring configuration parameters. For example, to enable disk monitoring and set the default threshold to 3 MB:
    # dsconf -D 'cn=Directory Manager' ldap://server.example.com config replace nsslapd-disk-monitoring=on nsslapd-disk-monitoring-threshold=3000000
  2. Restart Directory Server to load the new configuration.
    # dsctl instance_name restart