mirror of
https://github.com/shirou/gopsutil.git
synced 2025-04-26 13:48:59 +08:00
Add a check for logical volume paths
This commit is contained in:
parent
9f8e8d474b
commit
8037dc42c8
@ -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
|
// /dev/root is not the real device name
|
||||||
// so we get the real device name from its major/minor number
|
// so we get the real device name from its major/minor number
|
||||||
if d.Device == "/dev/root" {
|
if d.Device == "/dev/root" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user