-
Notifications
You must be signed in to change notification settings - Fork 602
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
Converting qcow2 images to raw is too slow #2579
Comments
It would be better to fix the speed of the builtin conversion so it will be fast even when QEMU is not installed. Given that the default emulation in Lima 1.0 will be VZ, qemu will be an optional dependency. |
I don't think that reinventing qemu-img good direction. The time spent on it can be spent on features that that add values to users. qemu-img is efficient, supports all images formats, well maintained, and available everywhere. |
You can default to We have used this trick elsewhere, like with SFTP or with XZ. The downside is having two code paths to test... |
On macOS, it is hard to install |
This may have a room for optimization |
I just found out that the built-in conversion needs more diskspace than $ df -h ~/.lima3
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk5 50Gi 692Mi 49Gi 2% 11 4.3G 0% /Users/jan/.lima3
$ l start --vm-type vz
? Creating an instance "default" Proceed with the current configuration
INFO[0001] Starting the instance "default" with VM driver "vz"
…
INFO[0002] Converting "/Users/jan/.lima3/default/basedisk" (qcow2) to a raw disk "/Users/jan/.lima3/default/diffdisk"
3.50 GiB / 3.50 GiB [-------------------------------------] 100.00% 206.87 MiB/s
INFO[0019] Expanding to 100GiB
FATA[0020] failed to convert "/Users/jan/.lima3/default/basedisk" to a raw disk "/Users/jan/.lima3/default/diffdisk": no space left on device Using |
Actually, it is not, with the builtin conversion. It turns into a fully allocated disk. So this is even worse. That also might explain why it takes so long: it possibly writes the full 100GB to disk. |
The non-sparse issue is being fixed in: |
I think the simplest way to fix it is to convert the image to raw after the download. There is no reason to keep qcow2 files in the cache when we use the file as a base disk, even when using qemu. We can try to optimize qcow2 convert later to make the initial download faster. New flow:
When creating a vm we can always do fast copy on the raw image from the cache. Questions:
Issues:
Testing shows that this makes limactl start almost 3 times faster: Starting from qcow2 image
Starting from raw image
|
Converting the compressed qcow2 is 1.6 times faster with lima-vm/go-qcow2reader#31 but matching qemu-img requires much more work. |
Converting once at the end of the download is better, but with improve go-qcow2reader this save only 2 seconds for the default image, so it is lower priority. I'll open a new issue for this to consider in future version. |
Description
Based on the logs, converting ubuntu server cloud image (xxx MiB) to raw format takes 17 seconds. The same operation using qemu-img convert takes 1.8 seconds.
Example log:
Same with qemu-img
Lima has nice progress bar during the slow convert, but qemu-img is fast enough so no progress bar is needed. It has also a progress bar option that can be used to extract progress if needed.
Fix:
qemu-img convert
if available-p
to show progressThe text was updated successfully, but these errors were encountered: