Most of the latest Microsoft Operating Systems with added packages/applications are available for download officially in VHDX/VHD file format as pre-installed images. Even though these VHD files are mainly made for Microsoft’s server virtualization hypervisor: Hyper-V, but still we can use them on Oracle VirtualBox. By using pre-installed virtual machine disk files, we can save a considerable amount of time. We can skip the steps of downloading the ISO file and doing the installation. This simple guide shows how to open and use Microsoft VHDX and VHD files on Oracle VirtualBox on a desktop computer.
VHDX and VHD Files
VHD: It is an older format. If you have any virtual machine image in VHD disk format, it is simple and straight forward to attach and use it on VirtualBox. You do not need to convert it to any other formats.
VHDX: It is the latest and recent format you will find. Most of the preinstalled images are available in this format from the Microsoft website. By default, VHDX will be opened as read-only in VirtualBox. As you are aware, with a read-only disk we can’t boot and use Operating System. In most of the cases, the Operating System will not boot from VHDX in VirtualBox.
VHDX Should Be Converted
The VHDX file should be converted to VDI format to use in VirtualBox. Though there are several methods and tools available to do it, using the inbuild VirtualBox command is ideal.
How to Convert VHDX to VDI?
a) Open the command prompt as Administrator.
b) Go to the VirtualBox installation location. Mostly it must be here,
c) Execute the following command. Make sure to change the correct path of the VHDX file and where you want the output.
VBoxManage.exe clonemedium disk "D:\Windows2019.vhdx" D:\Windows2019.vdi --format vdi
The above command will output the Windows2019.vhdx file to the VDI file format in D drive. Based on the size of the disk, it will take a few minutes.
Mount and Use VHDX on VirtualBox
Let’s assume you already converted the VHDX file to VDI (which is the original disk format of VirtualBox). Also, as mentioned earlier, VHD doesn’t have any issues in attaching.
Basically, you need to create a virtual machine with proper OS type which you downloaded from Microsoft or other sites. For example, if you downloaded Windows 2016 VHDX, create a new Windows 2016 VM. Fine tune the basic configuration of the virtual machine as you like, for example, processor cores, RAM, etc. But instead of creating a new virtual hard disk, you need to open the existing hard disk.
1) After downloaded the pre-installed virtual machine VHD/VHDX file (it comes as a compressed EXE file) from Microsoft, make sure to extract it by opening the EXE file.
In this example, I have downloaded Windows 2012 pre-installed VHD file which will be used to open on VirtualBox on my Windows 8 computer. The good thing about downloading these VHD files from Microsoft is, it comes with 180 days trail validity. This 6 months time should be enough for the experiment or to buy the license.
2) Create a Windows 2012 server virtual machine on VirtualBox as below. Make sure to select ‘Use an existing… disk’. Click on the browse button and browse the extracted VHD file.
If you have converted a VHDX file to VDI, then you need to point the VDI file to open and run the virtual machine.
3) That’s it, now you can power on the virtual machine. That will be running on the VHD (or the VDI file) you have downloaded.
It’s a great advantage of Oracle VirtualBox that supports multiple virtual hard disk formats like VHD, VMDK, HDD, and their VDI.
Here is the working Windows 2012 Virtual machine on VirtualBox which was downloaded from Microsoft site as a pre-installed VHD image.
I’m sure this guide is useful in converting VHDX file to VDI, then use it and older format of VHD on Oracle VirtualBox to run pre-installed Windows Operating System. By the way, this method is applicable to Windows, Linux, and macOS hosts as long as you have the latest VirtualBox.