Skip to content

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

songponssw
Copy link

Try to fix: #1448

How Lima edit disk

  • The limactl edit updates the disk value to the store. It does not resize disk image. Users have to manually resize by qemu-img
  • Does not support --shrink (fails to start instance)

What I did

  • create a limactl disk add command to add an existing qcow2 disk to Lima.
  • To update GuestOS disk, before start instance, It adds a diffdisk of the instance to Lima, resize, and delete.

@songponssw songponssw marked this pull request as ready for review April 17, 2025 05:34
@songponssw songponssw marked this pull request as draft April 17, 2025 05:34
func (inst *Instance) ResizeGuestOSDisk() error {
fName := filepath.Join(inst.Dir, filenames.DiffDisk)

cmd := exec.Command("limactl", "disk", "add", inst.Name, "--filename", fName)
Copy link
Member

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

@songponssw songponssw force-pushed the feat-edit-disk branch 2 times, most recently from b3f95e5 to a0800cf Compare April 17, 2025 09:18
@songponssw songponssw closed this Apr 25, 2025
Signed-off-by: Songpon Srisawai <songpon.ssw@gmail.com>
@songponssw songponssw reopened this Apr 25, 2025
@songponssw
Copy link
Author

This implementation works fine for increasing the disk size.
However, it returns an error when shrinking, as disk shrinking is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the disk size in lima.yaml should resize the disk
2 participants