I have a qcow2 image that I use to boot an installation of linux using QEMU; I would like to place the contents of that image directly onto a physical hard drive so that I can boot to that linux installation directly from my desktop. I would like to do something like dd if=my-qcow2.img of=/dev/sdb. However, this will clearly not work since qcow2 does not store the contents of the virtual disk in logical order within the qcow2 file. Any suggestions?
Add a comment |
1 Answer
QEMU comes with the qemu-img program to convert between image formats.
qemu-img convert -f qcow2 -O raw my-qcow2.img /dev/sdb - 3Pay attention that the QCOW2 format is Compressed! That means a 200GB QCOW2 image can convert into a 500GB hard drive... That may cause the "device is too small" error you are receiving imhoEtamar Laron– Etamar Laron2019-07-13 18:29:07 +00:00Commented Jul 13, 2019 at 18:29
- 12Old question, but: qemu-img nowadays features the
ddsubcommand, which I found slightly easier to understand. For example:qemu-img dd -f qcow2 -O raw bs=4M if=/vm-images/image.qcow2 of=/dev/sdd1. It works just like the usual standaloneddprogram.Binarus– Binarus2020-05-14 14:42:23 +00:00Commented May 14, 2020 at 14:42 - It's failing with
error while converting raw: Cannot grow device fileserror.recolic– recolic2023-04-17 22:56:06 +00:00Commented Apr 17, 2023 at 22:56 - 3@recolic That means that the destination disk is smaller than the uncompressed image.Daniel Pereira– Daniel Pereira2023-07-01 04:54:41 +00:00Commented Jul 1, 2023 at 4:54