Add a check for logical volume paths

This commit is contained in:
Tony Lambiris 2019-05-13 15:51:20 -04:00
parent 9f8e8d474b
commit 8037dc42c8
No known key found for this signature in database
GPG Key ID: 16A33C9959A40DED
1 changed files with 8 additions and 0 deletions

View File

@ -298,6 +298,14 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
}
}
if strings.HasPrefix(d.Device, "/dev/mapper/") {
devpath, err := os.Readlink(d.Device)
if err != nil {
return nil, err
}
d.Device = "/dev/" + filepath.Base(devpath)
}
// /dev/root is not the real device name
// so we get the real device name from its major/minor number
if d.Device == "/dev/root" {