|
@@ -7,6 +7,10 @@ import (
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
+// getDiskUsage 解析 df 命令的输出
|
|
|
+// df -B1 /dev/vdb
|
|
|
+// Filesystem 1B-blocks Used Available Use% Mounted on
|
|
|
+// /dev/vdb 527371075584 16390344704 484120408064 4% /mnt/disk001
|
|
|
func getDiskUsage(path string) (uint64, error) {
|
|
|
cmd := exec.Command("df", "-B1", path)
|
|
|
output, err := cmd.CombinedOutput()
|