@@ -36,7 +36,6 @@ import (
36
36
libmachinestate "github.com/crc-org/machine/libmachine/state"
37
37
"github.com/docker/go-units"
38
38
"github.com/pkg/errors"
39
- "golang.org/x/crypto/ssh"
40
39
)
41
40
42
41
const minimumMemoryForMonitoring = 14336
@@ -115,35 +114,20 @@ func growRootFileSystem(sshRunner *crcssh.Runner, preset crcPreset.Preset, persi
115
114
return err
116
115
}
117
116
118
- // with '/dev/[sv]da4' as input, run 'growpart /dev/[sv]da 4'
119
- if _ , _ , err := sshRunner .RunPrivileged (fmt .Sprintf ("Growing %s partition" , rootPart ), "/usr/bin/growpart" , rootPart [:len ("/dev/.da" )], rootPart [len ("/dev/.da" ):]); err != nil {
120
- var exitErr * ssh.ExitError
121
- if ! errors .As (err , & exitErr ) {
117
+ if preset == crcPreset .Microshift {
118
+ lvFullName := "rhel/root"
119
+ if err := growLVForMicroshift (sshRunner , lvFullName , rootPart , persistentVolumeSize ); err != nil {
122
120
return err
123
121
}
124
- if exitErr .ExitStatus () != 1 {
122
+ logging .Infof ("Resizing %s filesystem" , rootPart )
123
+ rootFS := "/sysroot"
124
+ if _ , _ , err := sshRunner .RunPrivileged (fmt .Sprintf ("Remounting %s read/write" , rootFS ), "mount -o remount,rw" , rootFS ); err != nil {
125
125
return err
126
126
}
127
- logging .Debugf ("No free space after %s, nothing to do" , rootPart )
128
- return nil
129
- }
130
-
131
- if preset == crcPreset .Microshift {
132
- lvFullName := "rhel/root"
133
- if err := growLVForMicroshift (sshRunner , lvFullName , rootPart , persistentVolumeSize ); err != nil {
127
+ if _ , _ , err = sshRunner .RunPrivileged (fmt .Sprintf ("Growing %s filesystem" , rootFS ), "xfs_growfs" , rootFS ); err != nil {
134
128
return err
135
129
}
136
130
}
137
-
138
- logging .Infof ("Resizing %s filesystem" , rootPart )
139
- rootFS := "/sysroot"
140
- if _ , _ , err := sshRunner .RunPrivileged (fmt .Sprintf ("Remounting %s read/write" , rootFS ), "mount -o remount,rw" , rootFS ); err != nil {
141
- return err
142
- }
143
- if _ , _ , err = sshRunner .RunPrivileged (fmt .Sprintf ("Growing %s filesystem" , rootFS ), "xfs_growfs" , rootFS ); err != nil {
144
- return err
145
- }
146
-
147
131
return nil
148
132
}
149
133
@@ -427,11 +411,6 @@ func (client *client) Start(ctx context.Context, startConfig types.StartConfig)
427
411
return nil , errors .Wrap (err , "Error updating public key" )
428
412
}
429
413
430
- // Trigger disk resize, this will be a no-op if no disk size change is needed
431
- if err := growRootFileSystem (sshRunner , startConfig .Preset , startConfig .PersistentVolumeSize ); err != nil {
432
- return nil , errors .Wrap (err , "Error updating filesystem size" )
433
- }
434
-
435
414
// Start network time synchronization if `CRC_DEBUG_ENABLE_STOP_NTP` is not set
436
415
if stopNtp , _ := strconv .ParseBool (os .Getenv ("CRC_DEBUG_ENABLE_STOP_NTP" )); stopNtp {
437
416
logging .Info ("Stopping network time synchronization in CRC VM" )
0 commit comments