-
Notifications
You must be signed in to change notification settings - Fork 654
Fix: resize GuestOS disk #3437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix: resize GuestOS disk #3437
Conversation
pkg/store/instance.go
Outdated
func (inst *Instance) ResizeGuestOSDisk() error { | ||
fName := filepath.Join(inst.Dir, filenames.DiffDisk) | ||
|
||
cmd := exec.Command("limactl", "disk", "add", inst.Name, "--filename", fName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limactl shouldn't invoke limactl itself unless it is inevitable or there is a significant benefit
b3f95e5
to
a0800cf
Compare
a0800cf
to
baaa08f
Compare
baaa08f
to
e794dd0
Compare
Signed-off-by: Songpon Srisawai <songpon.ssw@gmail.com>
This implementation works fine for increasing the disk size. |
Needs rebase |
@@ -157,6 +157,12 @@ func editAction(cmd *cobra.Command, args []string) error { | |||
if err != nil { | |||
return err | |||
} | |||
|
|||
inst, err = store.Inspect(inst.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason to inspect the instance twice should be explained as a code comment
format := string(img.Type()) | ||
|
||
if inst.Disk == diskSize { | ||
logrus.Infof("diffDisk size does not changed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug message can be removed
return errors.New("diffDisk: Shrinking is currently unavailable") | ||
} | ||
|
||
tmpDiskDir := filepath.Join(filenames.DisksDir, inst.Name+"-tmp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DisksDir
is dedicated for additional disks, and should not be used for the main disk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case, it would make sense to implement a separate ResizeDiffDisk()
function specifically for resizing the diffDisk
in the instance directory (e.g., ~/.lima/default/diffdisk)?
This implementation tries to reuse ResizeDataDisk()
, which was originally intended for additional disks.
Try to fix: #1448
How Lima edit disk
limactl edit
updates the disk value to the store. It does not resize disk image. Users have to manually resize byqemu-img
What I did
limactl disk add
command to add an existing qcow2 disk to Lima.diffdisk
of the instance to Lima, resize, and delete.