//go:build !windows package volsnap import ( "fmt" "golang.org/x/sys/unix" ) // freeDiskBytes returns the bytes available to an unprivileged process on the // filesystem backing path (used by the restore disk pre-check, C5). path must // exist; callers pass the live dir's parent. func freeDiskBytes(path string) (uint64, error) { var st unix.Statfs_t if err := unix.Statfs(path, &st); err != nil { return 0, fmt.Errorf("statfs %s: %w", path, err) } // Bavail is blocks available to non-root; Bsize is the fragment size. return st.Bavail * uint64(st.Bsize), nil }