mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
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>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user