Virtualbox Use Physical Disk

Now, you want to take your physical hard drive and have VirtualBox treat it like a virtual machine disk. Start by finding the mount point of your hard drive. Open up Disk Utility. Press Command +. To create an image that represents an entire physical hard disk (which will not contain any actual data, as this will all be stored on the physical disk), on a Linux host, use the command VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda. Because as you use space on a dynamically allocated virtual hard disk, VirtualBox must accommodate and adjust the VM's storage space, which causes the performance to take a hit. Instead of using.

Learning has never been so easy!

How-to convert a (UEFI-based) Windows 10 physical installation into an Oracle VirtualBox guest.

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

Step 1: Create a VHDX/VHD

Use

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

Simply select where you want to save the file to and click 'Create'

Step 2: Convert VHDX to VDI

Virtualbox

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.

Virtualbox Use Physical Disk

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.

Virtualbox Use Physical Disk Recovery Tool

Step 5: Restart VM to Disk

DiskVirtualbox

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.

Published: Nov 27, 2017 · Last Updated: Nov 28, 2017

References

  • Don't forget licensing requirements!
  • Hyper-V - Create and Use VHD of Windows 10 with Disk2VHD

14 Comments

  • Ghost Chili
    PatrickFarrell 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

  • Serrano
    Glorified 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.

  • Cayenne
    jhTech86 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.

  • Jalapeno
    nexus0000 Nov 28, 2017 at 02:11pm

    This is a neat guide, VMware has a free software that can do this as well. Kamen rider den o driver flash game.

    https://www.vmware.com/products/converter.html

  • Serrano
    WarKraft 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?

  • Serrano
    ScarInt 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.

  • Jalapeno
    SadTech0 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!

  • Mace
    bbigford 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?

  • Datil
    Simon 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.

  • Anaheim
    dtrade84 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.

  • Serrano
    Tony2065 Apr 21, 2019 at 02:35pm

    Good article. I haven't used Virtualbox in a while. I'l take another look at it.

  • Serrano
    Rich8790 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.

  • Serrano
    ShanePlus 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.

  • Pimiento
    spicehead-vbpyc Nov 14, 2019 at 01:56pm

    Thanks, just perfect and works like it should. Regards, Aym

Virtualbox Use Physical Disk Herniation

VirtualBox allows you to add new Hard Disks from the UI, you can just goto Virtual machine settings and add new hard disks, but its a bit tricky if you want to use as one of your hard disk partitions as the new hard disk, specially if your host is Windows OS. We are going to use VBoxManage utility which was installed with VirtualBox.

Virtualbox Use Physical Disk Windows 7

To be able to use any selected hard disk partition on your VirtualBox VM follow the steps below, I am going to give all the details and explanations but my assumption is you at least have an understanding of virtual machines, command line and environment variables.

What is VBoxManage?

VBoxManage utility allows you to configure and control almost all the aspects of VirtualBox which includes creating virtual hard disks, network interfaces configuring your virtual machines and much more.

For the purpose of this howto we are going to use VBoxManage to list the partitions, and then create a virtual disk file which will be pointing to one of the hard drive partitions.

Set up Environment Variable

First we need to set up the “PATH” environment variable, when ever you run a command on command line all the folders specified in “PATH” environment variable are search to find the respective executable.

Click on Start menu and type “system”, click on “System” Control Panel menu item.

Click “Environment Variables” in System properties window.

Virtualbox Use Physical Disk In Computer

Under “System Variables” select “Path” variable and click “Edit”.

Click “New”

Be default VirtualBox is installed in “C:Program FilesOracleVirtualBox”, if you haven’t installed in custom folder location just add this path in the new field.

Find Out The Hard Drive Number

Now we need to find out the Hard Drive number, so we can properly construct the PhsyicalDrive (more on this later) name for VBoxManage utility.

Click on Start Menu and type “hard disk partitions” and click on “Create and format hard disk partitions”.

In the “Disk Management” window note the Disk number from the left side of the disk.

Create Virtual Drive using VBoxManage

Now we are going to create a virtual disk which we will map to one of the partitions of our physical drive. As we have already noted the physical disk number which is “1” so our Physical Drive construct would look something like: “.PhysicalDrive1”

Click on Start Menu and type “cmd”, right-click on “Command Prompt” menu item and click “Run as administrator”.

Run the following command to get the list of partitions, so we can use the partition number in next command:

Comments are closed.