From 4e1a7bf42cd36ffac9e520e45905e8f9deebc307 Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:12:45 +0800 Subject: [PATCH] feat: optimization disk zie display (#10339) --- agent/app/service/disk_utils.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/agent/app/service/disk_utils.go b/agent/app/service/disk_utils.go index 901334d2c..c43b95c12 100644 --- a/agent/app/service/disk_utils.go +++ b/agent/app/service/disk_utils.go @@ -104,7 +104,7 @@ func parseLsblkOutput(output string) ([]response.DiskBasicInfo, error) { if diskType == "lvm" { total, used, avail, usePercent, _ := getDiskUsageInfo("/dev/mapper/" + name) - if total != "" { + if total != "" && fsType != "" { size = total } @@ -139,10 +139,17 @@ func parseLsblkOutput(output string) ([]response.DiskBasicInfo, error) { tran := fields["TRAN"] rota := fields["ROTA"] - totalSize, used, avail, usePercent, _ := getDiskUsageInfo("/dev/" + name) - if totalSize != "" && fsType != "" { - size = totalSize + var ( + used, avail, totalSize string + usePercent int + ) + if mountPoint != "" { + totalSize, used, avail, usePercent, _ = getDiskUsageInfo("/dev/" + name) + if totalSize != "" { + size = totalSize + } } + actualMountPoint := mountPoint actualFsType := fsType actualUsed := used