docs/Features/Admin-Panel/Problems/Disk-usage.md
Status: Design (proposed) · Owner: xet7 · Related (to be added):
server/lib/diskMonitor.js, server/lib/diskLog.js, models/lib/diskHighTracker.js,
models/eventLog.js, Admin Panel → Problems → Disk usage.
Sibling of the CPU-usage and RAM-usage monitors. A disk that fills up breaks WeKan (and FerretDB/SQLite) hard: uploads fail, the database cannot write, and other software on the same machine stops too. This subsystem watches free disk space on the filesystems WeKan uses and records only the start and end of each sustained high-usage period to an Admin Panel → Problems → Disk usage report, so operators get an early, self-describing warning before the disk is full — without a flood of rows.
WRITABLE_PATH / the configured storage), and
the temp path used while sanitizing uploads.statfs is not permitted) — this mirrors the existing upload
disk-space check in Filename, which already falls back
to small-RAM chunked streaming when free space cannot be read.Mirrors the CPU/RAM subsystems so the three Problems monitors share one shape, one event-stream mechanism, and one report template.
server/lib/diskMonitor.js samples on an interval (WEKAN_DISK_SAMPLE_INTERVAL_MS,
default 30s — disks change more slowly than CPU/RAM, so a longer interval avoids
needless statfs calls):
fs.statfs(path) (Node ≥ 18) for each watched path: bsize × blocks =
total bytes, bsize × bavail = bytes available to non-root. Used% =
(total − available) / total × 100.WRITABLE_PATH (attachments),
and WRITABLE_PATH/files/temp (upload sanitizing). Configurable via
WEKAN_DISK_WATCH_PATHS (a :-separated list) for non-standard layouts.models/lib/diskHighTracker.jsA pure, unit-tested state machine (identical shape to cpuHighTracker.js), tracked
per watched filesystem so a full data disk and a full attachments disk are
distinct episodes. Hysteresis prevents flapping:
WEKAN_DISK_HIGH_SAMPLES (2) consecutive samples at/above
WEKAN_DISK_HIGH_PERCENT (default 90% used);WEKAN_DISK_LOW_SAMPLES (2) consecutive samples below
WEKAN_DISK_LOW_PERCENT (default 85% used);Episodes are written to the eventLog collection on the disk stream (alongside
cpu and ram), shown by the existing eventStreamReport template. Two rows per
episode, per filesystem:
detected): high disk usage started (>= 90%) on /var/lib/wekan (attachments): 92% used, 6.1 GB free of 80 GB, WeKan: <activity>remediated): high disk usage ended after 12m on /var/lib/wekan (peak 97%, back under 85%): 71% used, 23 GB free of 80 GBSeverity: high at ≥ 95% used (imminent failure), else medium.
| Variable | Default | Meaning |
|---|---|---|
WEKAN_DISK_MONITOR | true | Master on/off. |
WEKAN_DISK_SAMPLE_INTERVAL_MS | 30000 | Sampling interval. |
WEKAN_DISK_HIGH_PERCENT | 90 | Enter high state at/above this used %. |
WEKAN_DISK_LOW_PERCENT | 85 | Leave high state below this used %. |
WEKAN_DISK_HIGH_SAMPLES | 2 | Consecutive high samples to enter. |
WEKAN_DISK_LOW_SAMPLES | 2 | Consecutive low samples to leave. |
WEKAN_DISK_WATCH_PATHS | (auto) | :-separated paths to watch, overriding the defaults. |
statfs → percentage helper are pure functions unit-tested
without Meteor (positive + negative: missing free-space info, zero-total
filesystems, per-filesystem episodes), exactly like cpuHighTracker.js.