Skip to content

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

Description

@lukaskirner

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions