Disk space check
Every 15 minutes: warns before a local file system runs full – free space in percent and absolute (10 % of 80 TB are still 8 TB), free inodes and the rate it fills (full within 48 hours, or within 6 hours at the rate of the last hour). In the journal, by mail with the module mail-relay and in the security report. Now: iac-disk-space
Add to a guest
In the guest as root – container and VM alike:
update --add-modules disk-spaceRuns a normal update and installs the module on the way.
From the Proxmox node, without logging in:
pct exec <ID> -- update --add-modules disk-space # container
ssh root@<IP> update --add-modules disk-spaceChoose when creating a guest
Without a dialog, on the Proxmox node:
IAC_NONINTERACTIVE=1 var_modules=auto-update,disk-space \
bash -c "$(curl -fsSL https://haypack.dev/<app>/ct.sh)"var_modules replaces the app's preselection – keep auto-update in the list if you want it. Interactive: choose “advanced” in the dialog, or tick the module in the generator on the app page.
Remove
update --remove-modules disk-spaceRemoves the module's packages, services, firewall rules and configuration again. Data stays.
Details
Checks the local file systems of the guest every 15 minutes and warns before one runs full – in the journal, by mail and in the security report.
When it warns
A percentage alone does not tell how urgent it is: 10 % of 80 GB are 8 GB, 10 % of 80 TB are still 8 TB. So a file system is low only when it is below both limits – and it is low when it fills fast, whatever is free now:
| Level | Space | Inodes | Rate |
|---|---|---|---|
| warning | less than 10 % and less than 50 GiB free | less than 10 % free | full within 48 hours at the rate of the last 24 hours |
| critical | less than 5 % and less than 10 GiB free | less than 5 % free | full within 6 hours at the rate of the last hour |
The rate needs samples first: a quarter of the window, so 15 minutes for the last hour and 6 hours for the last 24 hours. A file system that only gets emptier never warns for its rate.
How it notifies
| Where | When | Needs |
|---|---|---|
Journal (iac-disk-space) | every check, one line per file system – priority crit for critical, warning for low, info for ok | nothing |
| Mail to root | when a file system becomes low or critical, when its level changes, once a day while one stays low, and once when all are ok again | the module mail-relay – the mail goes to mail_root_to |
| Security report | every week and after every update: a line in the summary (disk space: 1 critical, 0 low), every file system in its own part and in security.json – so NetBox shows it too | the module security-report |
The subject of the mail names the guest and the file systems, e.g.
Disk space web1.example.org: 1 critical, 0 low: /srv; the text lists every file system as
iac-disk-space shows it. Without mail-relay there is no mail – the warnings are in the journal
and, with the module security-report, in its report. Test the mail with
printf 'Subject: test\n\nhello\n' | sendmail root.
Settings
In /etc/iac/settings.env, then run update – all optional:
disk_space_warn_percent=10 # warning below this percentage …
disk_space_warn_gb=50 # … and below this many GiB free
disk_space_warn_hours=48 # warning when full within this many hours (rate of 24 hours)
disk_space_crit_percent=5
disk_space_crit_gb=10
disk_space_crit_hours=6 # critical when full within this many hours (rate of the last hour)
disk_space_ignore=/media # mount points not to check, comma separated
disk_space_ignore is for file systems that other guests check already – e.g. the shared
/media of the module media-share. Network file systems (NFS, SMB) are never checked.
Read it
iac-disk-space # check now and show every file system
journalctl -u iac-disk-space -p warning # past warnings
systemctl list-timers iac-disk-space.timer
Disk space of web1.example.org – 1 critical, 0 low: /srv
CRITICAL /srv 41.2G free of 500.0G (8.2 %), losing 9.0G/h – full in ~5 h [growth]
OK / 6.1G free of 8.0G (76.3 %), inodes 89.0 % free
What it does not cover
S.M.A.R.T. and the health of the disks: an LXC container sees no disks, a VM only virtual
ones. That is the job of the Proxmox host – smartd runs there already; set a target under
Datacenter → Notifications and it mails disk errors.
When the module is removed, the check and its samples go again.
Prüft die lokalen Dateisysteme des Gasts alle 15 Minuten und warnt, bevor eines vollläuft – im Journal, per Mail und im Sicherheitsbericht.
Wann es warnt
Ein Prozentwert allein sagt nicht, wie dringend es ist: 10 % von 80 GB sind 8 GB, 10 % von 80 TB sind noch 8 TB. Deshalb ist ein Dateisystem nur knapp, wenn es unter beiden Grenzen liegt – und es ist knapp, wenn es schnell vollläuft, egal wie viel gerade frei ist:
| Stufe | Platz | Inodes | Tempo |
|---|---|---|---|
| Warnung | weniger als 10 % und weniger als 50 GiB frei | weniger als 10 % frei | voll in 48 Stunden beim Tempo der letzten 24 Stunden |
| kritisch | weniger als 5 % und weniger als 10 GiB frei | weniger als 5 % frei | voll in 6 Stunden beim Tempo der letzten Stunde |
Für das Tempo braucht es zuerst Messwerte: ein Viertel des Zeitfensters, also 15 Minuten für die letzte Stunde und 6 Stunden für die letzten 24 Stunden. Ein Dateisystem, das nur leerer wird, warnt nie wegen seines Tempos.
Wie es benachrichtigt
| Wo | Wann | Voraussetzung |
|---|---|---|
Journal (iac-disk-space) | bei jeder Prüfung, eine Zeile pro Dateisystem – Priorität crit für kritisch, warning für knapp, info für ok | keine |
| Mail an root | wenn ein Dateisystem knapp oder kritisch wird, wenn sich seine Stufe ändert, einmal täglich, solange eines knapp bleibt, und einmal, wenn wieder alle ok sind | das Modul mail-relay – die Mail geht an mail_root_to |
| Sicherheitsbericht | jede Woche und nach jedem update: eine Angabe in der Zusammenfassung (disk space: 1 critical, 0 low), jedes Dateisystem in einem eigenen Teil und in security.json – so zeigt es auch NetBox | das Modul security-report |
Der Betreff der Mail nennt den Gast und die Dateisysteme, etwa
Disk space web1.example.org: 1 critical, 0 low: /srv; der Text listet jedes Dateisystem so auf,
wie iac-disk-space es zeigt. Ohne mail-relay gibt es keine Mail – die Warnungen stehen im
Journal und, mit dem Modul security-report, in dessen Bericht. Die Mail testen mit
printf 'Subject: test\n\nhello\n' | sendmail root.
Einstellungen
In /etc/iac/settings.env, danach update – alle optional:
disk_space_warn_percent=10 # Warnung unter diesem Prozentwert …
disk_space_warn_gb=50 # … und unter so vielen GiB frei
disk_space_warn_hours=48 # Warnung, wenn voll in so vielen Stunden (Tempo von 24 Stunden)
disk_space_crit_percent=5
disk_space_crit_gb=10
disk_space_crit_hours=6 # kritisch, wenn voll in so vielen Stunden (Tempo der letzten Stunde)
disk_space_ignore=/media # Mountpoints, die nicht geprüft werden, durch Komma getrennt
disk_space_ignore ist für Dateisysteme, die andere Gäste schon prüfen – etwa das gemeinsame
/media des Moduls media-share. Netzwerk-Dateisysteme (NFS, SMB) werden nie geprüft.
Ablesen
iac-disk-space # jetzt prüfen und jedes Dateisystem zeigen
journalctl -u iac-disk-space -p warning # frühere Warnungen
systemctl list-timers iac-disk-space.timer
Disk space of web1.example.org – 1 critical, 0 low: /srv
CRITICAL /srv 41.2G free of 500.0G (8.2 %), losing 9.0G/h – full in ~5 h [growth]
OK / 6.1G free of 8.0G (76.3 %), inodes 89.0 % free
Was es nicht abdeckt
S.M.A.R.T. und der Zustand der Festplatten: Ein LXC-Container sieht keine Festplatten, eine VM
nur virtuelle. Das ist Aufgabe des Proxmox-Hosts – smartd läuft dort schon; unter
Datacenter → Notifications ein Ziel setzen, dann meldet er Festplattenfehler per Mail.
Wird das Modul entfernt, verschwinden die Prüfung und ihre Messwerte wieder.