Merge pull request #2847 from w9n/nvme

format: fix for nvme
This commit is contained in:
Rolf Neugebauer
2018-01-11 14:21:03 +00:00
committed by GitHub
19 changed files with 32 additions and 24 deletions

View File

@@ -171,7 +171,15 @@ func format(d, label, fsType string, forced bool) error {
return fmt.Errorf("Error running blockdev: %v", err)
}
partition := fmt.Sprintf("%s1", d)
var partition string
// check if last char is numeric in case of nvme
c := d[len(d)-1]
if c > '0' && c < '9' {
partition = fmt.Sprintf("%sp1", d)
} else {
partition = fmt.Sprintf("%s1", d)
}
if err := refreshDevicesAndWaitFor(partition); err != nil {
return err
}