-
Notifications
You must be signed in to change notification settings - Fork 725
Description
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.