From 8037dc42c845ee253378b42d6c6f107bbe1c2973 Mon Sep 17 00:00:00 2001 From: Tony Lambiris Date: Mon, 13 May 2019 15:51:20 -0400 Subject: [PATCH] Add a check for logical volume paths --- disk/disk_linux.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/disk/disk_linux.go b/disk/disk_linux.go index 51482c0c..d0dffa90 100644 --- a/disk/disk_linux.go +++ b/disk/disk_linux.go @@ -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" {