diff options
| author | zouyixiong <zouyixiong@gmail.com> | 2025-02-18 07:49:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 15:49:11 -0800 |
| commit | 739216189407b15f5a7be5e353a1d0234f674e04 (patch) | |
| tree | a222d58c90dbcb10f2022959c73fd8bef054bbf7 /weed | |
| parent | c2b894276992e8b3a879945d3eb9ff303fe47c74 (diff) | |
| download | seaweedfs-739216189407b15f5a7be5e353a1d0234f674e04.tar.xz seaweedfs-739216189407b15f5a7be5e353a1d0234f674e04.zip | |
fix: The free disk size and percentage are quite different from the output of df -h. (#6550)
* fix: record and delete bucket metrics after inactive
* feat: match available disk size with system cmd `dh -h`
* feat: move temp test to unmaintained/
---------
Co-authored-by: XYZ <XYZ>
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/stats/disk_supported.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/stats/disk_supported.go b/weed/stats/disk_supported.go index 633dfd00e..ee7d2d746 100644 --- a/weed/stats/disk_supported.go +++ b/weed/stats/disk_supported.go @@ -16,7 +16,11 @@ func fillInDiskStatus(disk *volume_server_pb.DiskStatus) { return } disk.All = fs.Blocks * uint64(fs.Bsize) - disk.Free = fs.Bfree * uint64(fs.Bsize) + // https://man7.org/linux/man-pages/man3/statvfs.3.html + // fs.Bfree: Number of free blocks + // fs.Bavail: Number of free blocks for unprivileged users + // disk.Free = fs.Bfree * uint64(fs.Bsize) + disk.Free = fs.Bavail * uint64(fs.Bsize) disk.Used = disk.All - disk.Free disk.PercentFree = float32((float64(disk.Free) / float64(disk.All)) * 100) disk.PercentUsed = float32((float64(disk.Used) / float64(disk.All)) * 100) |
