API, Boards Report, Broken Cards, CPU usage, Cards Report, Data health, Database problems and Disk usage get What it is, Read more, How to use it, How the numbers are calculated, How it works in WeKan and Commits, checked against the code. Corrections: the API table has the Location columns; the Boards Report filter says Signed-in users; Broken Cards says the Summary count leaves out unknown card types; the CPU tuning table lists the FerretDB watch, statistics and maintenance variables; the nightly Data health hours run to 06:00 and custom fields on no board have no repair; the database probe's thresholds are listed; Disk usage uses fs.statfsSync. The two design notes, Design and Durable operations, keep their text and get their commits. Thanks to xet7 !
8.9 KiB
Disk-usage monitor and Admin Panel → Problems → Disk usage
Status: Implemented (2026-10-17) · Owner: xet7 · Files:
server/lib/diskMonitor.js, server/lib/diskLog.js (through the shared
server/lib/resourceLog.js), models/lib/diskHighTracker.js, the disk stream in
models/eventLog.js, Admin Panel → Problems → Disk usage
(/admin/problems/disk). Tests: tests/diskHighTracker.test.cjs,
tests/resourceMonitorsWiring.test.cjs.
What it is
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.
Read more
- statfs(2) - the Linux
call whose block counts the percentage is computed from, and
Node.js
fs(fs.statfsSync). - Disk storage and Hysteresis on Wikipedia.
- WeKan: CPU-usage, RAM-usage, Filename (the pre-upload free-space check), Database problems (the database's own disk space finding).
How to use it
- Open your member menu (your avatar at the top right) and click Admin Panel.
- Click the Problems tab at the top.
- In the left menu, under Reports, click Disk usage.
- Read the live lines at the top: one per filesystem, with Disk usage N%, free / total GB, its path and what WeKan keeps there (database, attachments, uploads). They refresh every 30 seconds; a filesystem in a high period is highlighted.
- Below them, the table lists past high-usage periods, a start row and an end row for each. Type in the search box to filter as you type.
- Acknowledge or clear the stream on Summary.
To watch other paths, such as a database on its own disk, set
WEKAN_DISK_WATCH_PATHS (see Environment variables)
and restart WeKan.
How the numbers are calculated
- Total =
bsize × blocks, available =bsize × bavail(what a non-root process may still write, capped at the total), and used % =round((total − available) / total × 100)(statfsUsagein models/lib/diskHighTracker.js). Missing numbers or a zero-sized filesystem give no reading. - GB are binary (1024³ bytes), shown with one decimal under 10 and as a whole number from 10 up.
- Sampling every
WEKAN_DISK_SAMPLE_INTERVAL_MS(30 s, at least 5 s). - Start: after
WEKAN_DISK_HIGH_SAMPLES(2) consecutive samples at/aboveWEKAN_DISK_HIGH_PERCENT(90% used). End: afterWEKAN_DISK_LOW_SAMPLES(2) consecutive samples belowWEKAN_DISK_LOW_PERCENT(85% used). Tracked per filesystem. - Peak = the highest used % during the episode; duration = end − start, shown in seconds under 120 s and in rounded minutes from there.
- Severity:
highat ≥ 95% used (imminent failure), elsemedium. The end row isinfo.
How it works in WeKan
Requirements
- While WeKan (and FerretDB alongside it) run, watch how much disk space is used
on the filesystems that matter: the data/state filesystem (FerretDB SQLite / Mongo
data), the attachments storage path (
WRITABLE_PATH/ the configured storage), and the temp path used while sanitizing uploads. - Add an Admin Panel → Problems → Disk usage report.
- Log when high usage starts and when high usage ends — only those two rows per episode, so the report never floods.
- Each row records how much disk is used and free (used / total and percentage) per watched filesystem, the peak during the episode, its duration, and what WeKan/FerretDB were doing at the time.
- Best-effort and never throws; a no-op where free-space info is unavailable (e.g. a
sandbox where
statfsis 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.
Design
Mirrors the CPU/RAM subsystems so the three Problems monitors share one shape, one event-stream mechanism, and one report template.
Measurement — the filesystems WeKan uses.
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):
- Uses
fs.statfsSync(path)(Node ≥ 18) for each watched path; where it does not exist, nothing is sampled. - Watched paths, each measured once per filesystem (paths on the same device - the
devoffs.statSync- share one line and one episode): in the snap,SNAP_COMMON, which holds the database; the files root WeKan stores attachments in (WRITABLE_PATH, or itsfilesdirectory, as the self-checks use it); and itstempdirectory (uploads). A path that does not exist is skipped.WEKAN_DISK_WATCH_PATHS(a:-separated list) replaces the defaults for other layouts, such as a database on its own disk.
Start/end only — models/lib/diskHighTracker.js.
A pure, unit-tested state machine (the HighCpuTracker of cpuHighTracker.js),
tracked per watched filesystem so a full data disk and a full attachments disk
are distinct episodes. Hysteresis prevents flapping, and the peak used% seen during
the episode is kept for the end row.
Report — Admin Panel → Problems → Disk usage. Episodes are written to the
eventLog collection on the disk stream (alongside cpu and ram) by
server/lib/diskLog.js through
server/lib/resourceLog.js, and shown by
the existing eventStreamReport template. Two rows per episode, per filesystem:
- start (
detected):high disk usage started (>= 90%) on /var/lib/wekan (attachments): 92% used, 6.1 GB free of 80 GB, WeKan: <activity> - end (
remediated):high disk usage ended after 12m on /var/lib/wekan (peak 97%, back under 85%): 71% used, 23 GB free of 80 GB
Above the rows, a live line per filesystem (diskCurrentStatus in
client/components/settings/adminProblems.jade)
shows how full it is, free / total GB, its path and what WeKan keeps there,
refreshed every 30 seconds. The menu entry (report-disk) and the page title use
the existing sandstorm-disk-usage translation.
Environment variables
| Variable | Default | Meaning |
|---|---|---|
WEKAN_DISK_MONITOR |
true |
Master on/off. |
WEKAN_DISK_SAMPLE_INTERVAL_MS |
30000 |
Sampling interval (at least 5000). |
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. |
Notes and tests
- The tracker and the
statfs→ percentage helper are pure functions unit-tested without Meteor (positive + negative: missing free-space info, zero-total filesystems, per-filesystem episodes), exactly likecpuHighTracker.js: tests/diskHighTracker.test.cjs. tests/resourceMonitorsWiring.test.cjs pins the wiring, the translations and that this page says Implemented. - Observe-and-report only, like RAM-usage: WeKan cannot free disk on its own, so the value is an early, self-describing warning. It complements the existing pre-upload free-space check in Filename, which already refuses/streams-carefully when the attachments disk is low.