Disk Space Management
Running out of disk space can have a severe impact on the Uyuni database and file structure which, in some cases, is not recoverable.
Uyuni monitors some directories for free disk space. You can modify which directories are monitored, and the warnings that are created using environment variables in systemd service override files.
When the available space in one of the monitored directories falls below a warning threshold, a message is sent to the configured email address and a notification is shown at the top of the sign-in page.
Only the file systems that hold the monitored directories are checked.
1. Monitored Directories
By default, the Uyuni Server container monitors these directories:
-
/var/spacewalk -
/var/cache -
/srv
You can change which directories are monitored by setting the PODMAN_EXTRA_ARGS environment variable in the server container systemd service override file, which passes DISKCHECKDIRS to the container.
You can specify multiple directories by separating them with a space.
|
The |
-
Create a systemd override directory for the server service:
mkdir -p /etc/systemd/system/uyuni-server.service.d/
-
Create a configuration file with the custom directories:
cat > /etc/systemd/system/uyuni-server.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKDIRS=/var/spacewalk /var/cache /srv" EOF
-
Apply the configuration by restarting Uyuni:
mgradm restart
For more information about container volumes, see Persistent Container Volumes.
2. Thresholds
By default, Uyuni creates a warning when a monitored directory reaches 90% disk usage. A critical alert is created when a monitored directory reaches 95% disk usage, and the container health check will fail.
You can change these alert thresholds by setting the DISKCHECKALERT and DISKTHRESHOLD environment variables.
-
Create systemd override directories:
mkdir -p /etc/systemd/system/uyuni-server.service.d/ mkdir -p /etc/systemd/system/uyuni-db.service.d/
-
Create configuration files for both server and database services:
cat > /etc/systemd/system/uyuni-server.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT=90 --env DISKTHRESHOLD=95" EOF cat > /etc/systemd/system/uyuni-db.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT=90 --env DISKTHRESHOLD=95" EOF
-
Apply the configuration by restarting Uyuni:
mgradm restart
|
For large deployments with multi-terabyte storage volumes, you may want to use higher thresholds to make more efficient use of disk space. For example, on a 10 TB volume, keeping 5% free means 500 GB unused. For tuning recommendations for large deployments, see specialized-guides:large-deployments/tuning.adoc#diskcheck-thresholds. |
2.1. Free space thresholds
On large volumes, a percentage can raise alerts while plenty of space is still available. For example, a 6 TB volume that is 97% used still has about 200 GB available. In this case, you can define the thresholds as available space in megabytes (MB) instead of used space percentage, with these environment variables:
DISKCHECKALERT_FREE_MB-
A warning is created when the available space falls below this value. When set, it replaces the
DISKCHECKALERTpercentage threshold. DISKTHRESHOLD_FREE_MB-
A critical alert is created, and the container health check fails, when the available space falls below this value. When set, it replaces the
DISKTHRESHOLDpercentage threshold.
These variables are not set by default, so the percentage thresholds are used.
Each variable only replaces the percentage threshold of its own level.
For example, if you only set DISKTHRESHOLD_FREE_MB, warnings are still created using DISKCHECKALERT.
The values must be non-negative integers.
These variables can only be set as environment variables.
They have no equivalent in /etc/rhn/rhn.conf.
-
Create systemd override directories:
mkdir -p /etc/systemd/system/uyuni-server.service.d/ mkdir -p /etc/systemd/system/uyuni-db.service.d/
-
Create configuration files for both server and database services. This example creates a warning below 200 GB and a critical alert below 50 GB of available space:
cat > /etc/systemd/system/uyuni-server.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT_FREE_MB=204800 --env DISKTHRESHOLD_FREE_MB=51200" EOF cat > /etc/systemd/system/uyuni-db.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT_FREE_MB=204800 --env DISKTHRESHOLD_FREE_MB=51200" EOF
Each override file can only contain one
PODMAN_EXTRA_ARGSvalue. To set several disk check variables, such asDISKCHECKDIRSand the thresholds, add all the--envoptions to the same line. -
Apply the configuration by restarting Uyuni:
mgradm restart
|
The same thresholds apply to every monitored directory. If the monitored directories are on file systems of very different sizes, choose values that leave enough headroom on the smallest one. |
3. Database Disk Check
The database container has its own disk check that monitors only the PostgreSQL data directory (/var/lib/pgsql/data).
This directory is always monitored and cannot be changed or overridden with the DISKCHECKDIRS environment variable.
The database disk check uses the DISKCHECKALERT, DISKTHRESHOLD, DISKCHECKALERT_FREE_MB, and DISKTHRESHOLD_FREE_MB environment variables configured for the uyuni-db service.
The database disk check runs during the container health checks and when the container starts. When the critical threshold is exceeded, the health check will fail and the container will be automatically stopped to prevent data corruption. The container does not start while the critical threshold is exceeded.
The warnings and notifications for the database are created by a PostgreSQL function that reads the thresholds every time it runs. Changes to the thresholds take effect after you restart Uyuni.
|
The database container only monitors |
4. Disable Space Checking
The space checking tool is enabled by default and runs hourly via a Taskomatic scheduled task.
Notification can be disabled by disabling diskcheck-task-queue-default Taskomatic job.
To effectively disable disk space monitoring, set the threshold values to 99 (percent).
If you use the free space thresholds, set DISKCHECKALERT_FREE_MB and DISKTHRESHOLD_FREE_MB to 0 instead, because they replace the percentage thresholds.
-
Edit the systemd override files to set very high thresholds:
cat > /etc/systemd/system/uyuni-server.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT=99 --env DISKTHRESHOLD=99" EOF cat > /etc/systemd/system/uyuni-db.service.d/diskcheck.conf << 'EOF' [Service] Environment="PODMAN_EXTRA_ARGS=--env DISKCHECKALERT=99 --env DISKTHRESHOLD=99" EOF
-
Apply the configuration by restarting Uyuni:
mgradm restart
|
Disabling disk space monitoring is not recommended in production environments, as running out of disk space can cause severe and potentially unrecoverable damage to the database. |