Virtual to physical

CptCharis

Well-Known Member
Joined
Feb 27, 2018
Messages
563
Reaction score
465
Credits
982
Hello everybody long time no see, hope all you are fine.
Just a quick question, is there any way to migrate a qemu virtual machine into a physical box?
Thanks in advance.
 


I have done it in the past but I can't remember exactly what I did. I think I did something like this.
Code:
1. Create a raw image of the virtual machine: qemu-img convert test.qcow2 -O raw disk.img
2. Copy the raw image to a disk from a live environment: dd if=/media/CptCharis/disk.img of=/dev/sdX
If you want to have uefi boot you have will have to have installed your virtual machine as uefi boot as well.
 
I have done it in the past but I can't remember exactly what I did. I think I did something like this.
Code:
1. Create a raw image of the virtual machine: qemu-img convert test.qcow2 -O raw disk.img
2. Copy the raw image to a disk from a live environment: dd if=/media/CptCharis/disk.img of=/dev/sdX
If you want to have uefi boot you have will have to have installed your virtual machine as uefi boot as well.

I think I have repeat this question but I am not sure.
Anyway I will try and I will let you know.
Thanks a lot.
 
So dear @f33dm3bits, I made the .img and I copied to an external thump disk. When I boot from this thump disk, it “protested” that can’t did UUID, something that sound logic, and drop to an emergency shell. Do you have any idea ?
 
I thought you wanted to copy it to physical hardware? What I did is I copied the img file to a thumb drive, then I had a second thumb drive where I had a live environment of a distribution. I booted my system from the second thumb drive so that I had a live environment, then it would looked Iike this as in disk setup:
- sda: main disk of my pc
- sdb: thumb drive where I booted from into the live environment
- sdc: thumb drive where I copied the img file to.
For you I would double check which is which from the live environment using: lsblk
Then after you know which is which you can use dd to copy over the thumb drive with the img file.
Finally I copied over what I had on the thumb drive to the main disk of my pc.
Code:
dd bs=4M if=/dev/sdc of=/dev/sda conv=fsync oflag=direct status=progress
So what I did was a bit different, so do at your own risk what I explain. I think it is probably smart to have your other thumb drive with the live environment to be actually the distribution you want to boot/install in case things go south, unless it's Arch or Gentoo and you are out at sea without a working/stable internet connection. That's all the advice I can give on that, hope that helps ;)
 
Last edited:
I think I understand. So I definitely need to boot on a live media ?
 
Last edited:
I think I understand. So I defiantly need to boot on a live media ?
Yes if you want to copy it to your main hard disk of your computer, because it can't be in use while you are copying, that's the reason why you boot into a live enviroment from a second thumb drive. I'm just explaining how I did it last time I did this, this was a couple years ago but how I explained it in post #5 that is how I did it.
 

Members online


Top