diff --git a/disk/disk_unix.go b/disk/disk_unix.go index bc53d40..af4901d 100644 --- a/disk/disk_unix.go +++ b/disk/disk_unix.go @@ -16,14 +16,14 @@ func DiskUsage(path string) (*DiskUsageStat, error) { ret := &DiskUsageStat{ Path: path, Total: (uint64(stat.Blocks) * uint64(bsize)), - Free: (uint64(stat.Bfree) * uint64(bsize)), + Free: (uint64(stat.Bavail) * uint64(bsize)), InodesTotal: (uint64(stat.Files)), InodesFree: (uint64(stat.Ffree)), } ret.InodesUsed = (ret.InodesTotal - ret.InodesFree) ret.InodesUsedPercent = (float64(ret.InodesUsed) / float64(ret.InodesTotal)) * 100.0 - ret.Used = (ret.Total - ret.Free) + ret.Used = (uint64(stat.Blocks) - uint64(stat.Bfree)) * uint64(bsize) ret.UsedPercent = (float64(ret.Used) / float64(ret.Total)) * 100.0 return ret, nil