From 9e6d35411713ce930fecbccb627175c907c4d609 Mon Sep 17 00:00:00 2001 From: xxxizum1kxxx <244161265+xxxizum1kxxx@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:57:33 +0800 Subject: [PATCH] =?UTF-8?q?Comment=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=BF=85?= =?UTF-8?q?=E8=A6=81=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- monitoring/unit/disk.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monitoring/unit/disk.go b/monitoring/unit/disk.go index 43021be..74f7d20 100644 --- a/monitoring/unit/disk.go +++ b/monitoring/unit/disk.go @@ -14,6 +14,7 @@ type DiskInfo struct { func Disk() DiskInfo { diskinfo := DiskInfo{} + // 获取所有分区,使用 true 避免物理磁盘被 gopsutil 错误排除 usage, err := disk.Partitions(true) if err != nil { diskinfo.Total = 0 @@ -107,7 +108,8 @@ func isPhysicalDisk(part disk.PartitionStat) bool { } fstype := strings.ToLower(part.Fstype) - // // 针对 Linux autofs:它只是自动挂载的触发器,真实文件系统会作为单独分区出现。 + + // 针对 Linux autofs:排除自动挂载的 trigger,真实文件系统会作为单独分区出现不会被排除。 // 将 autofs 视为“非物理磁盘”可以避免重复统计容量。 if fstype == "autofs" && !strings.HasPrefix(part.Device, "/dev/") { return false