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.


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-readonly-on-threshold
  • nsslapd-disk-monitoring-threshold
For details about these parameters, see the parameter descriptions in the Red Hat Directory Server Configuration, Command, and File Reference.
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 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. Optional: Configure Directory Server to switch the database to read-only mode if half of the threshold you set in the nsslapd-disk-monitoring-threshold is reached:
    # dsconf -D 'cn=Directory Manager' ldap://server.example.com config replace nsslapd-disk-monitoring-readonly-on-threshold=on
    With this setting, the databases cannot be modified until Directory Server successfully shuts down the instance. This can prevent data corruption.


    With this setting, Directory Server does not start if the free disk space is below half of the threshold configured in the nsslapd-disk-monitoring-threshold.
  3. Restart Directory Server to load the new configuration.
    # dsctl instance_name restart