yuzu

disk_space

What it doesReports free / total disk space for a single volume
Version1.0.0
KindCollector · read-only · gathered (crossplatform.storage.free)
PlatformsWindows ✅ · macOS ✅ · Linux ✅
Actionsfree (definition crossplatform.storage.free)
Securitysecurable Inventory · operation Read · risk Low · dispatch ReadOnly · approval gate None
Rolesexecute: endpoint-admin, endpoint-operator · author: content-author

How it works

free is the plugin’s only action: it stats one volume and reports total bytes, caller-usable free bytes, and percent used. The volume is selected by the optional path parameter (default C:\ on Windows, / on POSIX); the plugin never enumerates volumes itself, so a caller wanting every volume on a host must call it once per path. free_bytes is deliberately the quota-aware, caller-visible figure — FreeBytesAvailableToCaller on Windows, f_bavail on POSIX — not the raw free-block count, because the plugin exists to answer “does this installer have headroom,” which is a per-caller question. Thresholds (how much free space is enough) are not the plugin’s concern; they live with the caller, matching os_info’s convention. The whole action is one synchronous stat call — no subprocess, no retry, no caching inside the plugin.

flowchart LR
  OP[Operator / workflow<br/>or /auto pre-flight] --> SRV[Server<br/>authz: Inventory.Read]
  SRV -- gRPC mTLS --> HOST[Agent plugin host] --> EX[disk_space.execute]
  EX --> WIN[Windows leg<br/>GetDiskFreeSpaceExW]
  EX --> MAC[macOS leg<br/>statfs 2]
  EX --> LIN[Linux leg<br/>statvfs 2]
  WIN & MAC & LIN --> ROWS[disk row, no typed status] --> RS[(ResponseStore)] --> API[REST /api/responses · /auto pre-flight · device-live disk card]

OS capability

ActionWindowsmacOSLinux
free✅ supported · rung 1 · GetDiskFreeSpaceExW✅ supported · rung 1 · statfs(2)✅ supported · rung 1 · statvfs(2)

Privileges and prerequisites

OSRuns asExtra grant neededMeasuredIf the read is refused
Windowsagent service account (LocalSystem today, #1442)None. GetDiskFreeSpaceExW needs no elevated access.2026-09-07, bare-metal, SYSTEMerror|failed to query disk space for path: <path>, non-zero return
macOSagent daemon (root today per docs/agent-privilege-model.md)None. statfs(2) on an accessible path needs no privilege.2026-09-07, bare-metal, euid 501 (unprivileged — the capture ran outside the real daemon identity)error|failed to stat path: <path>, non-zero return
Linuxagent daemon (yuzu user, unprivileged, per docs/agent-privilege-model.md)None. statvfs(2) needs no privilege.2026-09-06, container, euid 0error|failed to stat path: <path>, non-zero return

No external binaries, no subprocesses, no network access — one in-process OS call per platform (agents/plugins/disk_space/src/disk_space_plugin.cpp:97-134).

Data contract

Inputs

DefinitionParameterTypeRequiredDefaultConstraintsDescription
crossplatform.storage.freepathstringno-maxLength 4096Directory or volume root to measure (e.g. “C:”, ”/”, “/var”). Defaults to the platform root if omitted (C:\ on Windows, / on Linux and macOS); reported free space is the caller-usable figure, not raw free blocks.

Outputs

One pipe-delimited row per call. Field 0 is the literal discriminator disk; the four columns below map to fields 1–4. On failure the plugin emits error|<message> instead and returns non-zero — there is no partial-success row.

crossplatform.storage.free — path|total_bytes|free_bytes|percent_used

FieldTypeValuesAvailableExampleDescription
pathstring-Windows, Linux, macOS/The resolved path that was measured, echoed back verbatim from the request. Values: free text.
total_bytesint64-Windows, Linux, macOS494384795648Raw volume capacity in bytes. Values: integer.
free_bytesint64-Windows, Linux, macOS313557938176Space usable by an ordinary caller, not raw free blocks (FreeBytesAvailableToCaller on Windows, f_bavail on POSIX). Values: integer.
percent_usedint32-Windows, Linux, macOS36Percent of total_bytes currently used, truncated to an integer 0-100.

Result status

This plugin does not set a typed result status; the agent records UNDECLARED and the sample shows UNDECLARED / UNKNOWN /.

Where the data goes

Sample output

Windows — captured: windows Microsoft Windows NT 10.0.26200.0 x64 · bare-metal · 2026-09-07 · SYSTEM · leg-hash 16f60d46b82f

== action=free
disk|C:\|248158089216|20788936704|91
[result_status] UNDECLARED / UNKNOWN

macOS — captured: macos macOS 26.6.2 arm64 · bare-metal · 2026-09-07 · euid 501 (jsmith) · leg-hash 16f60d46b82f

== action=free
disk|/|494384795648|313557938176|36
[result_status] UNDECLARED / UNKNOWN

Linux — captured: linux Debian GNU/Linux 13 (trixie) aarch64 · container · 2026-09-06 · euid 0 · leg-hash 16f60d46b82f

== action=free
disk|/|485473984512|407729123328|16
[result_status] UNDECLARED / UNKNOWN

Caveats and known gaps

  1. No typed result status. The plugin never calls set_result_status; every capture reads UNDECLARED / UNKNOWN / regardless of platform or outcome. A caller distinguishing success from failure must check for the leading error| row and the non-zero return, not the status field.
  2. percent_used is not directly comparable across OSes. Linux’s f_bavail excludes the root-reserved slack that Windows’ FreeBytesAvailableToCaller does not withhold in the same way, so the same physical fill level reads a few points higher on Linux (agents/plugins/disk_space/src/disk_space_plugin.cpp:130-131).
  3. total_bytes is raw media capacity, not compared with disk_actions. The two plugins measure independently; do not assume disk_space.free’s total_bytes and disk_actions.volumes’ total_bytes for the same path are byte-identical without checking both mechanisms.
  4. Windows suppresses the session-0 hard-error dialog per call. ThreadErrorModeGuard sets SEM_FAILCRITICALERRORS only for the duration of the GetDiskFreeSpaceExW call, thread-scoped rather than process-wide, specifically so a not-ready removable or BitLocker-locked volume degrades to an error| row instead of blocking a dispatch-pool worker on a hidden dialog (agents/plugins/disk_space/src/disk_space_plugin.cpp:56-72, :96-97).
  5. macOS uses statfs, not statvfs, on purpose. statvfs’s block-count type is 32-bit on Darwin and would truncate a volume above roughly 16 TiB; statfs’s counters are 64-bit (agents/plugins/disk_space/src/disk_space_plugin.cpp:29-32, :108-111). Do not “simplify” this to statvfs for cross-platform symmetry with the Linux leg.

Source and tests