diff --git a/attach.go b/attach.go index bc80f4e3..eb721220 100644 --- a/attach.go +++ b/attach.go @@ -39,12 +39,15 @@ func (e *EC2Instance) AttachEbsVolumes() { if !filesystem.DoesDriveExistWithTimeout(deviceName, 10) { volLogger.Fatalf("Drive %s doesn't exist after attaching - checked with stat 10 times", deviceName) } - - volume.AttachedName = deviceName - localVolumes[key] = append(localVolumes[key], volume) } else { - localVolumes[key] = append(localVolumes[key], volume) + deviceName = volume.AttachedName + } + realDeviceName, err := filesystem.GetActualBlockDeviceName(deviceName) + if err != nil { + volLogger.Fatalf("Couldn't get real device name of %s", deviceName) } + volume.AttachedName = realDeviceName + localVolumes[key] = append(localVolumes[key], volume) } } e.Vols = localVolumes diff --git a/ebs.go b/ebs.go index 49f40e96..07fef8bf 100644 --- a/ebs.go +++ b/ebs.go @@ -77,7 +77,7 @@ func prepAndMountDrives(volName string, vols []EbsVol) { driveNames = append(driveNames, driveName) } if driveName, err = filesystem.CreateRaidArray(driveNames, volName, raidLevel); err != nil { - driveLogger.Fatalf("Error when creating reaid array: %v", err) + driveLogger.Fatalf("Error when creating RAID array: %v", err) } } @@ -101,7 +101,7 @@ func prepAndMountDrives(volName string, vols []EbsVol) { return } - driveLogger.Info("Checking if something already mounted at %s", mountPath) + driveLogger.Infof("Checking if something already mounted at %s", mountPath) if isMounted, err := filesystem.IsMounted(mountPath); err != nil { driveLogger.Fatalf("Error when checking mount point for existing mounts: %v", err) } else { diff --git a/filesystem/drive.go b/filesystem/drive.go index 5321d465..8894f535 100644 --- a/filesystem/drive.go +++ b/filesystem/drive.go @@ -35,7 +35,7 @@ func DoesDriveExist(driveName string) bool { return true } -// GetLocalBlockDeviceName returns the actual name of the block device seen +// GetActualBlockDeviceName returns the actual name of the block device seen // within the instance (useful for nitros) func GetActualBlockDeviceName(name string) (string, error) { for _, device := range listNvmeBlockDevices() {