diff --git a/pkg/util/disk/iscsi.go b/pkg/util/disk/iscsi.go index 52bad4762e..d90f43a874 100644 --- a/pkg/util/disk/iscsi.go +++ b/pkg/util/disk/iscsi.go @@ -268,10 +268,12 @@ func GetDiskPathFromBindDeviceFilePath(logger *zap.SugaredLogger, mountPath stri var sanitizedDevices []string for _, dev := range devices { - sanitizedDevice := strings.TrimPrefix(dev, "devtmpfs[") - sanitizedDevice = strings.TrimSuffix(sanitizedDevice, "]") - sanitizedDevice = filepath.Clean(sanitizedDevice) // Fix extra slashes - sanitizedDevices = append(sanitizedDevices, sanitizedDevice) + if prefixEnd := strings.Index(dev, "["); prefixEnd != -1 { + sanitizedDevice := dev[prefixEnd+1:] // Start after `[` + sanitizedDevice = strings.TrimSuffix(sanitizedDevice, "]") + sanitizedDevice = filepath.Clean(sanitizedDevice) // Fix extra slashes + sanitizedDevices = append(sanitizedDevices, sanitizedDevice) + } } if len(sanitizedDevices) != 1 {