Jump to content

Convert VM to new physical machine


Go to solution Solved by SpaceInvaderOne,

Recommended Posts

I have a new PC on the way, but want to get started with building the system in a VM. I'm going to install Ubuntu 22.04.4 on it, along with Docker, Tdarr (node), etc etc etc. Basically, what I want to do when the new pc arrives is to connect it's hard drive to the server via a USB adapter, copy/clone the VM to that drive, then install the drive in the PC.

I have Ubuntu installing now, but just wanted to see what has to be done for the clone/copy when the time comes.

Link to comment
  • Solution

Yes its very straight forward. We can use the qemu-img tool to convert a virtual disk image  to a physical disk.
If the image is a raw image (by default in Unraid it is) then you would use this command

 

qemu-img convert -f raw -O raw /mnt/user/domains/vm_name/vdisk1.img /dev/sdX


If the image was a qcow2 image then the command would be

 

qemu-img convert -f qcow2 -O raw /mnt/user/domains/vm_name/vdisk1.img /dev/sdX


So the  /dev/sdX refers to the disk you want to copy it to. Plug the disk that you want to use for the real machine into the server and it will get a letter. So for instance the  /dev/sdg   Be careful its the correct one as you dont want to write over an anraid array disk etc.

Also just make sure the location of the vdisk for the vm is correct  for this part   /mnt/user/domains/vm_name/vdisk1.img

Link to comment
10 hours ago, SpaceInvaderOne said:

Yes its very straight forward. We can use the qemu-img tool to convert a virtual disk image  to a physical disk.
If the image is a raw image (by default in Unraid it is) then you would use this command

 

qemu-img convert -f raw -O raw /mnt/user/domains/vm_name/vdisk1.img /dev/sdX


If the image was a qcow2 image then the command would be

 

qemu-img convert -f qcow2 -O raw /mnt/user/domains/vm_name/vdisk1.img /dev/sdX


So the  /dev/sdX refers to the disk you want to copy it to. Plug the disk that you want to use for the real machine into the server and it will get a letter. So for instance the  /dev/sdg   Be careful its the correct one as you dont want to write over an anraid array disk etc.

Also just make sure the location of the vdisk for the vm is correct  for this part   /mnt/user/domains/vm_name/vdisk1.img


I found your video early this morning on how to do it. I'm building the physical to virtual now. Next will be converting the virtual to physical next.

When I set up the new VM (Windows 11) from the now-creating vdisk, other than using the manual setting to select the img file, is there anything else special that I need to do?

Link to comment
  • 3 months later...
  • 1 month later...
On 7/28/2024 at 6:58 PM, SterlingF said:

What Video is this?

This is the only video I could find and it's a little after 10mins in. Not the same steps, but it is the same premise. The steps in the video are what worked for me.

dd='/mnt/user/domains/Ubuntu/vdisk1.img' of='/dev/sdX' status=progress

 

Edited by kalyway
code
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...