Page 1 of 1

Windows 7 EFI & GPT:In both VM and native (Linux as host)

PostPosted: 7. Oct 2013, 02:10
by diggy
This guide is based on HOWTO: Windows 7: In both VM and native -- VBox3.x with modifications on booting from an EFI PC on GPT hard disk WITHOUT using virtualbox'es EFI.

This is just a quick write-up and needs some serious cleanup. Also requires high level of skills to fiddle with without breaking your system.
I started trials several weeks ago but just today found some time to make it work, there may be information missing, so bear with me.
Unfortunately I have very little free time to rewrite the whole guide so I'll just point out the differences, where needed and some things you might have to figure out on your own or ask for help on the forum.

1) Follow the original guide up to the point of creating the vmdk.

2) Since Windows expect to find 3 partitions the command to run to create the raw vmdk is modified to:
Code: Select all   Expand viewCollapse view
sudo VBoxManage internalcommands createrawvmdk -filename raw123.vmdk -rawdisk /dev/sda -partitions 1,2,3 -relative -mbr myMBR.mbr

The command above assumes the following partition schema:
[*] partition 1 - FAT Boot partition, containing the bootloader
[*] partition 2 - Microsoft reserved partition. Just put it there, I have no idea of it's use.
[*] partition 3 - Windows OS partition. This is the one that has all the files visible from within Windows

If you have your partitions placed in a different order or place, change accordingly.

3) Load the vmdk in a SATA controller in the VM (from now on VM_7).

After you've set up successfully the VM_7 you should get started with the bootloading process.
Since EFI for Windows is buggy (if I'm wrong correct me) we won't be using virtualbox'es built-in EFI at all.

We'll use a tool called DUET - rodsbooks(dot)com/bios2uefi/

4) Setup a new VM (from now on VM_DUET) to put DUET into. Using a 200mb virtual disk will be enough. DUET page provides detailed installation instructions.

5) After installation, power down VM_DUET and load the newly created virtual disk (with DUET) to another VM (from now on VM_AUX) as a secondary disk.

6) As root, copy the EFI directory from the host OS (containing Windows bootcode) from it's location to another handy folder preferably in user's home.

To find out where the boot partition is mounted use:
Code: Select all   Expand viewCollapse view
mount|grep boot

7) Make that folder shared to VM_AUX.

8 ) Mount the DUET virtual disk and copy the EFI directory from the host machine.

The directory structure should be like:

9) Unmount DUET's virtual disk and power down VM_AUX

10) Load DUET to VM_7 in an IDE controller.

11) Continue with the rest of the original guide.

12) Cross your fingers and power up VM_7

There'll be an error message from the Windows bootloader stating: Status 0xc0000225 The boot selection failed because a required device is inaccessible. Just press enter to move on.

General Notes
1) It's risky.
2) You may encounter all problems stated in the original guide.
3) I haven't tried installing Vbox additions.
4) I haven't tried booting Native windows so I don't know if anything is broken.
5) At some point in the beginning I fiddled with the bootloaders BCD and added some extra boot options. I have no idea which option boots. If you can't get it to work with the original one (that came from windows installation) I'll look at the BCD to see what I've changed.
6) Since its my second post forum rules don't let me post urls so you'll have to decode the one for duet (not so hard, is it?)

I hope it'll be usefull to someone, if it works as stated (it did for me).


Dimitrios Tanis

Re: Windows 7 EFI & GPT:In both VM and native (Linux as host

PostPosted: 25. Aug 2014, 17:01
by RushPL
Thank you Dimitrios, I found your post quite accidentally just when I was going to redo my setup without UEFI. It seems to have booted my Windows 7 Pro from VirtualBox on openSUSE. It is now checking the disk. Thank you thank you thank you!

Re: Windows 7 EFI & GPT:In both VM and native (Linux as host

PostPosted: 25. Aug 2014, 17:15
by mpack
Hmm. I seem to have missed this tutorial when it was written. I'll move this to the tutorials section where it won't get lost but bear in mind that this tutorial is untested by me! Hence there are no guarantees, and please don't bother PMing me for an explanation.

Also note that this tutorial is about get Windows 7 running both natively and as a VM, where the host is using EFI. This is not about getting the Windows guest to use VirtualBox's EFI.