diff --git a/pkg/crc/machine/start.go b/pkg/crc/machine/start.go index 689fbad80a..3fb980612c 100644 --- a/pkg/crc/machine/start.go +++ b/pkg/crc/machine/start.go @@ -117,8 +117,17 @@ func growRootFileSystem(sshRunner *crcssh.Runner, preset crcPreset.Preset) error return err } - if err := runGrowpart(sshRunner, rootPart); err != nil { - return err + // with '/dev/[sv]da4' as input, run 'growpart /dev/[sv]da 4' + if _, _, err := sshRunner.RunPrivileged(fmt.Sprintf("Growing %s partition", rootPart), "/usr/bin/growpart", rootPart[:len("/dev/.da")], rootPart[len("/dev/.da"):]); err != nil { + var exitErr *ssh.ExitError + if !errors.As(err, &exitErr) { + return err + } + if exitErr.ExitStatus() != 1 { + return err + } + logging.Debugf("No free space after %s, nothing to do", rootPart) + return nil } if preset == crcPreset.Microshift { @@ -160,21 +169,6 @@ func getrootPartition(sshRunner *crcssh.Runner, preset crcPreset.Preset) (string return rootPart, nil } -func runGrowpart(sshRunner *crcssh.Runner, rootPart string) error { - // with '/dev/[sv]da4' as input, run 'growpart /dev/[sv]da 4' - if _, _, err := sshRunner.RunPrivileged(fmt.Sprintf("Growing %s partition", rootPart), "/usr/bin/growpart", rootPart[:len("/dev/.da")], rootPart[len("/dev/.da"):]); err != nil { - var exitErr *ssh.ExitError - if !errors.As(err, &exitErr) { - return err - } - if exitErr.ExitStatus() != 1 { - return err - } - logging.Debugf("No free space after %s, nothing to do", rootPart) - } - return nil -} - func growLVForMicroshift(sshRunner *crcssh.Runner, lvFullName string, rootPart string) error { if _, _, err := sshRunner.RunPrivileged("Resizing the physical volume(PV)", "/usr/sbin/pvresize", "--devices", rootPart, rootPart); err != nil { return err