Skip to content

Commit

Permalink
Add a check for logical volume paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Lambiris committed May 13, 2019
1 parent 9f8e8d4 commit 8037dc4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 8037dc4

Please sign in to comment.