How-to convert a (UEFI-based) Windows 10 physical installation into an Oracle VirtualBox guest.
In order for VirtualBox to be able to boot the physical Windows 10 disk, you need to a create a special VMDK (Virtual Machine Disk) file that represents the physical disk. These raw host disk access VMDK files do not actually contain any data from the physical disk, they are just a pointer that VirtualBox can use to access it. So I am trying to set up raw device access w/ VirtualBox to use a ext4/linux disk as a guest OS within Mac OS X, but haven't succeeded yet. Following the VirtualBox docs, Chapter 9.9.1.1, https://.
You will need Windows 10 installation .iso to complete this guide. Don't forget to make sure you are licensed properly as well.
5 Steps total
Virtualbox Use Physical Disk
Step 1: Create a VHDX/VHD
You will need to run (as administrator) SysInternal's Disk2vhd on the computer you are converting
Download Disk2vhd from https://docs.microsoft.com/en-us/sysinternals/downloads/disk2vhd
Virtualbox Use Physical Disk Drive
Simply select where you want to save the file to and click 'Create'
Step 2: Convert VHDX to VDI
Do you tip medical transport drivers license. On the computer you have Oracle VirtualBox installed run the following command in Powershell (as administrator). You will need to run this command from the directory that VirtualBox is installed to i.e. C:Program FilesOracleVirtualBox
./VBoxManage clonehd .vhdx .vdi --format VDI
Step 3: Create a Virtualbox VM
Create a New VM from within VirtualBox Manager and choose 'Use an existing virtual disk file' which points to your newly created VDI file.
After it is created open Settings for the VM.
Under System > Motherboard make sure only Hard Disk and Optical is selected, Optical is at the top of the boot order and 'Enable EFI (special OSes only)' is ticked.
Under Storage, point the optical drive to the Windows 10 installation ISO.
Configure the rest as you please.
Step 4: Boot VM to Optical Media
Once you have booted to the installation media and it is asking for 'Language to install,' etc, press Shift+F10. This will open a command prompt.
In the command prompt run 'diskpart'
Enter the command: 'list vol'
This will list off the volumes and should show Volume 3 as a RAW FS. You will need to format this EFI partition. Use the following commands
'sel vol 3'
'format quick fs=fat32 label='System'
If you enter 'list vol' again you will see the changes made.
Exit diskpart by entering command 'exit'
Run the command 'bcdboot C:Windows' which will add the required boot records.
Step 5: Restart VM to Disk
You can now close out of the installation media and restart. On restart make sure you don't boot from the Optical drive again and it should boot into Windows as expected.
You have now converted your physical Windows 10 UEFI device to an Oracle VirtualBox VM.
Below I have added a reference to doing this in Hyper-V, which is part of what I followed to create the above guide. I have also added a reference to licensing requirements as suggested by a comment.
References
- Don't forget licensing requirements!
- Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD
14 Comments
- Ghost ChiliPatrickFarrell Nov 27, 2017 at 04:27am
Make sure it's licensed properly when you do this.
https://community.spiceworks.com/how_to/124053-licensing-windows-10-with-virtualization-technologies-how-to
- SerranoGlorified Pet Rock Nov 27, 2017 at 01:55pm
I was just about to write my own tutorial on this same subject. We still have some Fire Control Panels that MUST talk to a Win XP for programming and nothing else. I have been converting a Win XP dual boot to a VHD for use in Oracle VM for this issue. Great write up.
- CayennejhTech86 Nov 27, 2017 at 07:42pm
Just read the licensing post. I didn't realize that Chris spoke Chinese. I assume the licensing info was written in Chinese because I couldn't make heads or tails from it.
- Jalapenonexus0000 Nov 28, 2017 at 02:11pm
This is a neat guide, VMware has a free software that can do this as well.
https://www.vmware.com/products/converter.html
- SerranoWarKraft Nov 28, 2017 at 03:06pm
Cool article thank anyone out there know how to do this to create a vm box on vmware host?
- SerranoScarInt Nov 28, 2017 at 03:13pm
This was my missing step (diskpart and bcdboot) for migrating a bare metal server (Server 2012) to KVM. Volume names were different, but that was easy to re-interpret.
- JalapenoSadTech0 Jan 19, 2018 at 08:05pm
I did this step by step in a lab environment and it went perfect. Good to learn for future use. Thanks!
- Macebbigford Feb 23, 2018 at 04:27pm
Nice write up. I'm assuming this is just a test machine, or maybe something being used for OS deployment/builds?
- DatilSimon Matthews Apr 4, 2018 at 01:55am
This was originally a request from a customer because they needed to be able to access an old database for a piece of hardware they were replacing. In the end it turned out we only needed to backup the database and keep a copy. The person installing the new piece of hardware had no idea about how the software (they were supposed to be experts with) worked.
- Anaheimdtrade84 Feb 12, 2019 at 06:33pm
I have Windows 10 running on VirtualBox, but it seems to be running a little slow. Any tips on how I can speed it up? I'm running Windows 7 on a dual boot MacBook Pro late 2011, with an i7 and 8GB of ram. I tried it on Workstation Pro 15, and still slow. Any help will be appreciated.
Thank you.
- SerranoTony2065 Apr 21, 2019 at 02:35pm
Good article. I haven't used Virtualbox in a while. I'l take another look at it.
- SerranoRich8790 May 23, 2019 at 01:39pm
Feeling embarrassed.. having an brain freeze..I am not seeing anything about step 4. It looks like the virtual is running, but I do not see any display, just a black screen.
- SerranoShanePlus Aug 6, 2019 at 12:14am
@dtrade84
Your laptop will support 16GB of RAM. I would consider maxing it out and running the Windows 10 instance with 8GB of RAM. - Pimientospicehead-vbpyc Nov 14, 2019 at 01:56pm
Thanks, just perfect and works like it should. Regards, Aym