Thursday, April 25, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 42818  / 1 Year ago, fri, february 10, 2023, 7:42:50

I have a KVM Server and I am using qcow2 as vm image format



I need to convert virtual machines into physical machines



Any helpfull idea?


More From » kvm-virtualization

 Answers
6

It's not even that hard, it just takes some time, a Ubuntu LiveCD, and an external USB disk (if you don't have more than one internal disks).



Preliminary step: Convert the disk to something useful



You can do this from your current system without having to boot to a LiveCD.



Load a terminal and fire in:



cd /media/wherever-the-image-is/

sudo apt-get install qemu-kvm

qemu-img convert test.qcow2 -O raw disk.img


Move /media/wherever-the-image-is/disk.img somewhere that you're not about to write to. If you're planning to write it to the disk that it's currently sitting on, you'll want to stick it on a separate internal disk, or, worst-comes-to-worst an external disk.



The following instructions assume you've moved it to /media/dave/disk.img (dave is an external USB disk)



Before you do any serious writing, make sure you have backups. CloneZilla can help you take whole disk backups if you have somewhere for that data to be stored.



Write the image to a disk of its very own



You'll want to do something like this. This assumes you're going to overwrite a whole disk.



Boot into an Ubuntu Live CD and click Try Ubuntu.



Mount your the place where your qcow2 image is being stored (eg the external USB disk as /media/dave). Do not mount the place where you want to write to.



Then we go to work:



sudo dd if=/media/dave/disk.img of=/dev/sdX


You want to replace sdX with the correct path to your destination disk. The sudo password is blank, just hit return.



You can then open gparted or something else and you should see your Ubuntu partition sitting on the disk. You should be able to expand it out.


[#35200] Saturday, February 11, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tonhorn

Total Points: 196
Total Questions: 118
Total Answers: 95

Location: Vanuatu
Member since Fri, May 13, 2022
2 Years ago
;