Create Windows guest from EFI existing installation

This is for discussing general topics about how to use VirtualBox.
Post Reply
AndreaSim
Posts: 3
Joined: 16. Feb 2020, 17:15

Create Windows guest from EFI existing installation

Post by AndreaSim »

I have a laptop with Windows 7. I want to create a virtual machine from this installation.
I'm going to use this guest system on both Windows and Linux hosts.
Here the steps I did:
  1. make a vhdx clone of my Windows partition using disk2vhd
  2. convert to vdi: VBoxManage.exe clonemedium disk "Windows 7.vhdx" "Windows 7.vdi" --format vdi
  3. in VBox created a new Windows 7 64-bit machine
  4. add the newly created vdi file under SATA controllers
  5. enable the EFI support in settings > system > motherboard
  6. boot the machine
But even before run the o.s. it stops at the UEFI shell.
I'm not sure if I did something wrong or this behavior is correct and I just don't know how to boot.

Please feel free to ask other information you may need.
Thanks in advance.
birdie
Posts: 429
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Create Windows guest from EFI existing installation

Post by birdie »

VBox EFI implementation doesn't support Windows 7 unfortunately.

You can convert your Windows 7 guest to boot using a standard MBR scheme though it's not straightforward but doable.

Steps to accomplish that:

BACKUP your GUEST VM FIRST.
  1. Create a new standard Windows 7 VM (non-EFI), install it, extract its boot partition (normally /dev/sda1)
  2. Boot your existing EFI guest with any Linux LiveCD, e.g. http://www.system-rescue-cd.org/
  3. Use gparted to convert GPT to MBR
  4. Remove all partitions except the one where Windows 7 is installed
  5. Create a new partition, NTFS and copy a partition from 1) to it, and mark it active
  6. You will also have to copy the first 440 bytes from your 1) to your exisiting VM
  7. You will have to disable EFI, boot from a Windows 7 installation CD, and recreate BCD
  8. You will probably have to remove all the devices from HKEY_LOCAL_MACHINE\System\MountedDevices
In short it's a lot to be done :wink: I can do that for you for a fee if you cannot accomplish that.
AndreaSim
Posts: 3
Joined: 16. Feb 2020, 17:15

Re: Create Windows guest from EFI existing installation

Post by AndreaSim »

Thanks for your complete answer.
It's a pity VBox doesn't allow this. I'm going to do a try with the other VBox concurrent, first :-)
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Create Windows guest from EFI existing installation

Post by mpack »

AndreaSim wrote:It's a pity VBox doesn't allow this.
Of course VirtualBox "allows" EFI/GPT. It's Win7 that won't work with the VirtualBox implementations. More modern Windows editions work fine.

p.s. "/dev/sda1" is not a Windows nomenclature. I assume some kind of Linux tool is assumed, best mention it if so.

p.p.s. Does GParted now offer a GPT <-> MBR conversion feature? Interesting.
birdie
Posts: 429
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: Create Windows guest from EFI existing installation

Post by birdie »

mpack wrote:p.p.s. Does GParted now offer a GPT <-> MBR conversion feature? Interesting.
Gparted doesn't, console gdisk does. Sorry, my bad.
Post Reply