From cef09d7cb126075cfee372ee431ed5a7839f6aa4 Mon Sep 17 00:00:00 2001 From: henrygd Date: Tue, 31 Mar 2026 12:58:42 -0400 Subject: [PATCH] fix(agent): fix windows root disk detection if exe not running on root disk (#1863) --- agent/disk.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/agent/disk.go b/agent/disk.go index f1043c9c..32731104 100644 --- a/agent/disk.go +++ b/agent/disk.go @@ -631,9 +631,17 @@ func (a *Agent) updateDiskIo(cacheTimeMs uint16, systemStats *system.Stats) { } } -// getRootMountPoint returns the appropriate root mount point for the system +// getRootMountPoint returns the appropriate root mount point for the system. +// On Windows it returns the system drive (e.g. "C:"). // For immutable systems like Fedora Silverblue, it returns /sysroot instead of / func (a *Agent) getRootMountPoint() string { + if runtime.GOOS == "windows" { + if sd := os.Getenv("SystemDrive"); sd != "" { + return sd + } + return "C:" + } + // 1. Check if /etc/os-release contains indicators of an immutable system if osReleaseContent, err := os.ReadFile("/etc/os-release"); err == nil { content := string(osReleaseContent)