Preallocating qemu-img images


Icon from the Tango Desktop Project

To drastically improve virtual drive performance of qemu guests, create images with metadata preallocation:

% qemu-img create -f qcow2 -o size=2147483648,preallocate=metadata disk.qcow2

Then if you're on Linux, use fallocate to preallocate space:

% fallocate -l 2147483648 disk.qcow2

Passing this on for what it may be worth, they both saved me a lot of time copying files this morning. :)

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.