磁盘空间管理
磁盘空间不足可能会对 SUSE Multi-Linux Manager 数据库和文件结构造成严重影响,在某些情况下,这种影响不可恢复。
SUSE Multi-Linux Manager 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.
当某个受监控目录的可用空间低于警告阈值时,会向配置的电子邮件地址发送一条消息,并在登录页面顶部显示一条通知。
1. 受监控的目录
By default, the SUSE Multi-Linux Manager Server container monitors these directories:
-
/var/spacewalk -
/var/cache -
/srv
You can change which directories are monitored by setting the DISKCHECKDIRS environment variable in the server container systemd service. 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="DISKCHECKDIRS=/var/spacewalk /var/cache /srv" EOF
-
Apply the configuration by restarting SUSE Multi-Linux Manager:
mgradm restart
For more information about container volumes, see Persistent Container Volumes.
2. 阈值
By default, SUSE Multi-Linux Manager 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="DISKCHECKALERT=90" Environment="DISKTHRESHOLD=95" EOF cat > /etc/systemd/system/uyuni-db.service.d/diskcheck.conf << 'EOF' [Service] Environment="DISKCHECKALERT=90" Environment="DISKTHRESHOLD=95" EOF
-
Apply the configuration by restarting SUSE Multi-Linux Manager:
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. |
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 and DISKTHRESHOLD environment variables configured for the uyuni-db service.
The database disk check runs as a PostgreSQL function and is invoked during container health checks. When the threshold is exceeded, the health check will fail and the container will be automatically stopped to prevent data corruption.
|
The database container only monitors |
4. 禁用空间检查
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).
-
Edit the systemd override files to set very high thresholds:
cat > /etc/systemd/system/uyuni-server.service.d/diskcheck.conf << 'EOF' [Service] Environment="DISKCHECKALERT=99" Environment="DISKTHRESHOLD=99" EOF cat > /etc/systemd/system/uyuni-db.service.d/diskcheck.conf << 'EOF' [Service] Environment="DISKCHECKALERT=99" Environment="DISKTHRESHOLD=99" EOF
-
Apply the configuration by restarting SUSE Multi-Linux Manager:
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. |