I have installed both Windows and Linux on separate drives, but their boot managers are located on the same drive, which is the Linux drive.
My intention is to use VirtualBox in Linux to run my existing Windows installation. To do this, I created a vdmk image of /dev/sda and added it to the VirtualBox VM.
However, when I attempted to boot the VM, I received the following error message: “FATAL: Could not read from the boot medium! System halted.
”
I believe this is because the boot manager for Windows is on a different drive. The output of fdisk -l
confirms this.
Disk /dev/nvme0n1: 119.25 GiB, 128035676160 bytes, 250069680 sectors
Disk model: SAMSUNG MZVLW128HEGR-000L2
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 4FE65E84-A0C4-4173-AD7F-CE3C128F56B4
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 234883071 234881024 112G Linux filesystem
/dev/nvme0n1p2 234883072 247875583 12992512 6.2G Linux swap
/dev/nvme0n1p3 247875584 250069646 2194063 1G EFI System
Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors
Disk model: Samsung SSD 850
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 369746B4-CA1B-47E1-84C8-237D4200861E
Device Start End Sectors Size Type
/dev/sda1 2048 634562559 634560512 302.6G Linux filesystem
/dev/sda2 634562560 976773119 342210560 163.2G Microsoft basic data
The boot manager for Windows 10 is stored on the EFI System Partition (/dev/nvme0n1p3), along with the boot manager for my Linux partition, which is rEFInd.
I am unsure how to inform VirtualBox about the location of Windows’ boot manager.
3 Answers
Dualbooting Windows Guest from Linux Host in VirtualBox
VirtualBox is a free and open-source virtualization software that allows users to run multiple operating systems on a single machine. It is an excellent tool for developers who want to test their applications on different platforms. With VirtualBox, you can create virtual machines and run them on your host operating system. VirtualBox supports a wide range of guest operating systems, including Windows, Linux, and macOS.
In this tutorial, we will show you how to run your existing Windows installation on a Linux host using VirtualBox. We assume that you have already installed both Windows and Linux on separate drives, and their boot managers are located on the same drive, which is the Linux drive.
Creating a Virtual Machine in VirtualBox
The first step is to create a new virtual machine in VirtualBox. To create a new virtual machine, open VirtualBox and click on the “New” button. This will open the “Create Virtual Machine” wizard. Follow the steps below to create a new virtual machine:
1. Enter a name for your virtual machine. This can be any name you choose.
2. Select the type of operating system you want to install. In this case, select “Windows” as the type of operating system.
3. Select the version of Windows you want to install. If you have already installed Windows on your physical machine, select the version you have installed.
4. Allocate memory to the virtual machine. The amount of memory you allocate will depend on the amount of RAM you have on your physical machine.
5. Create a virtual hard disk. Select “Create a virtual hard disk now” and click on “Create”.
6. Choose the type of virtual hard disk you want to create. Select “VDI (VirtualBox Disk Image)”.
7. Choose the storage details for the virtual hard disk. You can choose to allocate a fixed size or a dynamically allocated size.
8. Choose the location and size of the virtual hard disk. This will be the location where the virtual hard disk will be stored on your physical machine.
Adding an Existing Virtual Hard Disk to the Virtual Machine
Now that you have created a new virtual machine, the next step is to add the existing Windows installation to the virtual machine. To do this, follow the steps below:
1. Open VirtualBox and select the virtual machine you created in the previous step.
2. Click on the “Settings” button. This will open the “Settings” window.
3. Click on the “Storage” tab.
4. Click on the “Add Hard Disk” button. This will open the “Add Hard Disk” wizard.
5. Select “Choose Existing Disk”.
6. Browse to the location where the virtual hard disk of your Windows installation is stored and select it.
7. Click on “OK” to save the settings.
Configuring the Boot Order of the Virtual Machine
The next step is to configure the boot order of the virtual machine. By default, the virtual machine will try to boot from the virtual hard disk you created in step 1. However, since we want to boot from the existing Windows installation, we need to change the boot order. To do this, follow the steps below:
1. Open VirtualBox and select the virtual machine you created in the previous step.
2. Click on the “Settings” button. This will open the “Settings” window.
3. Click on the “System” tab.
4. Click on the “Motherboard” tab.
5. Check the “Enable EFI (special OSes only)” checkbox.
6. Click on the “Processor” tab.
7. Allocate the number of processors you want to use.
8. Click on the “Boot Order” tab.
9. Change the boot order so that the virtual machine boots from the existing Windows installation. To do this, move the hard disk containing the Windows installation to the top of the boot order list.
10. Click on “OK” to save the settings.
Booting the Virtual Machine
Now that you have configured the virtual machine, you can start it and boot into the existing Windows installation. To do this, follow the steps below:
1. Open VirtualBox and select the virtual machine you created in the previous step.
2. Click on the “Start” button. This will start the virtual machine.
3. The virtual machine will boot into the existing Windows installation.
Conclusion
VirtualBox is an excellent tool for developers who want to test their applications on different platforms. By following the steps in this tutorial, you can run your existing Windows installation on a Linux host using VirtualBox. This will allow you to test your applications on both Windows and Linux without the need for multiple physical machines.
To boot the Windows installation in a VirtualBox virtual machine, you will need to add the EFI System Partition (ESP) to the virtual machine as a bootable device.
To do this, follow these steps:
- Start the VirtualBox Manager and select the virtual machine that you want to boot from the ESP.
- Click on the “Settings” button for the virtual machine.
- In the “General” section, click on the “Advanced” tab.
- Under “Boot Order,” move the “EFI” option to the top of the list.
- Click on the “Storage” section and select the “Add Hard Disk” button.
- Choose the “Add Optical Drive” option and select the “Add IDE Controller” button.
- Click on the “Add IDE Hard Disk” button and choose the option to “Create a new hard disk file.”
- Choose the “VDI (VirtualBox Disk Image)” option and click the “Create” button.
- Choose the “Fixed size” option and click the “Next” button.
- Enter a name for the VDI file and select the “EFI System Partition” as the source.
- Click the “Create” button to create the VDI file.
- Add the VDI file to the virtual machine by clicking the “Add Hard Disk” button and selecting the “Add Hard Disk” option.
- Choose the “Existing hard disk” option and select the VDI file that you just created.
- Start the virtual machine and it should boot from the EFI System Partition, allowing you to boot the Windows installation.
I hope this helps! Let me know if you have any questions or if you need further assistance.
To resolve the issue, I included the drive that contains the Windows boot manager (/dev/nvme0n1), in addition to enabling EFI in the Virtual Machine’s settings.