How to turn a Physical Windows 10 Install into a Win10 VM on unraid?


Recommended Posts

I read theres a program called Disk2vhd which will allow me to create a vm snapshot of my physical Windows 10 machine.  Then I can suppodly load that in VMware, but not unraid.  I also read that you have to convert the .VHD file created by Disk2vhd into a .img file unraid can read.  Whats the best way to do this?  Or is there a way to directly turn my windows 10 machine into a .img file unraid can read without first making it a .VHD?

Link to comment
On 5/15/2021 at 11:03 AM, 007craft said:

I read theres a program called Disk2vhd which will allow me to create a vm snapshot of my physical Windows 10 machine.  Then I can suppodly load that in VMware, but not unraid.  I also read that you have to convert the .VHD file created by Disk2vhd into a .img file unraid can read.  Whats the best way to do this?  Or is there a way to directly turn my windows 10 machine into a .img file unraid can read without first making it a .VHD?

 

You can use dd but this will create a flat image, so if you have your windows physical disk of 1 tb the dd command will create a clone image of 1 tb.

Better to use qemu-img command to create a sparse image.

Assuming your windows 10 disk is /dev/sda

qemu-img convert -p -S 512 /dev/sda -O raw /path/to/image/destination/win10image.img

Make sure that the disk of /path/to/image/destination has enough space!

I never tried, but the command should create a sparse image of let's say 1 tb (based on the example above), but with the -S option the command will write zeroes for the not used space. -->  with the -S argument I don't know if the command creates an image of a size corresponding to that effectively used by the vm or if it creates an image of a size of that of the disk with unused spaced filled with zeroes.

If it creates a file of a size corresponding to that of the disk you can run again the qemu-img command to deduplicate the image:

qemu-img convert -p -O raw win10image.img dedup-win10image.img

This will create a deduplicated image without the zeroes, so it will shrink its size.

 

Important: always take into account the needed space of the destination disk to perform conversions of images.

-------------

By the way you can also convert the vhd image with qemu-img:

qemu-img convert -f vpc -O raw /path/to/vhd/file/image.vhd /path/to/destination/image.img

Or you can directly use the vhd file in qemu/libvirt, example attaches the disk to bus virtio, (however my choice would be to convert it):

<disk type='file' device='disk'>
    <driver name='qemu' type='vpc' cache='none' io='native' discard='unmap' />
    <source file='/path/to/file.vhd'/>
    <target dev='vda' bus='virtio'/>
</disk>

 

Edited by ghost82
  • Thanks 3
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.