Setting up a disk image/clone to run on a VM

Licensing issues

You have to realize that your Windows activation will be void and you need to reactivate the VM which may fail as the key you try to activate is likely bound to a key in your hardware’s efivarfs.

This perhaps makes it a better choice to cough up a digtal windows license and install from scratch.

Conversion


There is likely several methods available - I have personally used the following with no issues.

It can be done but you have a few hoops to jump and you need a separate storage device with room for your Windows installation.

The old forum topic does not exist anymore.

Keep in mind what mode you current Windows boots (BIOS or EFI) - you will have to ensure the VM boot the same way. If you want a truly portable - independent VM - you need to go the reinstall in a VM defaulting to BIOS boot.

Depending on your choices and the Windows version you may need to do some registry editing prior to installing the system from scratch.

The steps to migrate your current Windows is - roughly - as follows

  1. Locate download and install the Windows tool Disk2VHD - download from Microsoft
  2. Locate and download the windows sdelete utility. - download from Microsoft
  3. use sdelete to zero your running Windows unused space
  4. defrag your windows windows
  5. run sdelete one more time
  6. use windows disk manager to resize the partition something between 80 and 127G
  7. Use disktovhd to convert your running windows to hyperv using the vhdx format
  8. Use vbox-manage to convert the vhdx file to a vdi file
  9. Create a new Windows VM using virtualbox
  10. If your current system is EFI you must use EFI otherwise the vm won’t start
  11. and instead of creating a virtual disk you attach the vdi created above

It is a time consuing process which requires a lot of diskspace.

raw disk option

Another - less used option - is to add the physical device as a raw disk beforehand - so instead of creating a disk - for the newly created vm you can attach the raw device.

If you go down that road - you need to ensure you user has adequate rights to access a raw device - on the /dev/sdxY path - a normal user doesn’t and running the vm as root is not a good solution.

Using a raw device presents it’s own issues - e.g. device access is exclusive to the windows vm

3 Likes