From 9de661b5df9ae85833a4a1942c2d55a963080ac9 Mon Sep 17 00:00:00 2001 From: tw93 Date: Mon, 16 Feb 2026 19:08:25 +0800 Subject: [PATCH] fix(status): prefer internal disks over external in disk listing When multiple disks are connected, the status command was sorting only by size, causing external disks to appear first when they are larger than the internal disk. This resulted in showing incorrect free space (external disk size) instead of the internal disk. The sort now prioritizes internal disks before sorting by size, ensuring the internal disk always appears first. Fixes #466 --- cmd/status/metrics_disk.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/status/metrics_disk.go b/cmd/status/metrics_disk.go index 4a360d4..da14f4d 100644 --- a/cmd/status/metrics_disk.go +++ b/cmd/status/metrics_disk.go @@ -82,6 +82,11 @@ func collectDisks() ([]DiskStatus, error) { annotateDiskTypes(disks) sort.Slice(disks, func(i, j int) bool { + // First, prefer internal disks over external + if disks[i].External != disks[j].External { + return !disks[i].External + } + // Then sort by size (largest first) return disks[i].Total > disks[j].Total })