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://iac.heyer.systems/<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.