Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetFileSystemUsage(...) returns Kilobytes instead of Bytes #69

Open
lukaskirner opened this issue Nov 14, 2023 · 1 comment
Open

GetFileSystemUsage(...) returns Kilobytes instead of Bytes #69

lukaskirner opened this issue Nov 14, 2023 · 1 comment

Comments

@lukaskirner
Copy link

lukaskirner commented Nov 14, 2023

GetFileSystemUsage returns Kilobytes instead of Bytes.

Example Code which should print the used Gigabytes:

package main

import (
	"fmt"

	sigar "github.com/cloudfoundry/gosigar"
)

func main() {
	s := sigar.ConcreteSigar{}
	fsUsage, _ := s.GetFileSystemUsage("/System/Volumes/Data")

	gbUsed := float64(fsUsage.Used) / 1024 / 1024 / 1024  // converting bytes to Gigabytes
	fmt.Printf("%3.2f GB used\n", gbUsed)
}

Result on my machine:

0.34 GB used

Expected result:

> df -h
Filesystem       Size   Used  Avail Capacity iused      ifree %iused  Mounted on
...
/dev/disk3s5    460Gi  338Gi  108Gi    76% 6446774 1131120840    1%   /System/Volumes/Data
...

OS: macOS
gosigar version: 1.3.36

@beyhan
Copy link
Member

beyhan commented Nov 23, 2023

We would love to review a PR if you want to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting for Changes | Open for Contribution
Development

No branches or pull requests

2 participants