Skip to content
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

Daemon leaks instances when launching with low --disk #680

Closed
ricab opened this issue Mar 14, 2019 · 0 comments · Fixed by #812
Closed

Daemon leaks instances when launching with low --disk #680

ricab opened this issue Mar 14, 2019 · 0 comments · Fixed by #812
Assignees
Labels

Comments

@ricab
Copy link
Collaborator

ricab commented Mar 14, 2019

The --disk option does not work with a size below the virtual size of the relevant image. This makes sense (to avoid data loss). However, it is currently only enforced by the underlying qemu-img command.

multipassd itself does not perform this check and leaves files behind when qemu-img fails. The most significant of which is the copy of the image file.

This means that a few hundreds of MB of disk are leaked on such occasions. The regular user does not realize this and leaves the files behind.

$ multipass launch --disk 1G
launch failed: Cannot resize instance image

$ multipass list
No instances found.

$ du -sh ~/.local/share/multipassd/vault/instances/deep-midge/*
20K     /home/ricab/.local/share/multipassd/vault/instances/deep-midge/cloud-init-config.iso
328M    /home/ricab/.local/share/multipassd/vault/instances/deep-midge/ubuntu-18.04-server-cloudimg-amd64.img

$ qemu-img info /home/ricab/.local/share/multipassd/vault/instances/deep-midge/ubuntu-18.04-server-cloudimg-amd64.img | grep size
virtual size: 2.2G (2361393152 bytes)
disk size: 328M
cluster_size: 65536

The daemon logs

[warning] [qemu-img] qemu-img: warning: Shrinking an image will delete all data beyond the shrunken image's end. Before performing such an operation, make sure there is no important data there.
qemu-img: Use the --shrink option to perform a shrink operation.

@Saviq Saviq added the bug label Apr 29, 2019
@townsend2010 townsend2010 self-assigned this May 30, 2019
bors bot added a commit that referenced this issue May 31, 2019
812: launch: Clean up instance data if an error occurs during image prep r=townsend2010,ricab a=townsend2010

Fixes #680

814: Teach fmtlib to deal with QString, can remove lots of toStdString() calls r=ricab,townsend2010 a=gerboland

RFC. Do we want?

Co-authored-by: Chris Townsend <[email protected]>
Co-authored-by: Ricardo Abreu <[email protected]>
Co-authored-by: Gerry Boland <[email protected]>
Saviq added a commit that referenced this issue Jun 17, 2019
812: launch: Clean up instance data if an error occurs during image prep r=townsend2010,ricab a=townsend2010

Fixes #680

Co-authored-by: Chris Townsend <[email protected]>
Co-authored-by: Ricardo Abreu <[email protected]>
@Saviq Saviq mentioned this issue Jun 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants