Trying to boot into my physically installed Windows 10 from Linux via VirtualBox--both are on the same hard-disk. I read a lot of sources:
Possible to dual boot *and* virtualize same physical drive containing Windows 10?
- Using a Physical Hard Drive Pariition as a VirtualBox VM and as a Bootable Partition
- VirtualBox Manual - Chapter 05. Virtual Storage
- VirtualBox Manual - Chapter 09. Advanced Topics
- Running a real Windows install in VirtualBox on Linux
The issue I'm having is having a boot partition to load the Windows 10 EFI.
From what I have gathered, this is the process I did:
- Created
.vmdk:
sudo VBoxManage internalcommands createrawvmdk \
-filename win10.vmdk \
-rawdisk /dev/nvme0n1 -partitions 2,3,4 \
-relative -mbr win10.mbr
Note: partition 2, 3 and, 4 are Microsoft Reserved Partition, main NTFS partition, and Windows RE. I don't want to have the /boot/efi partition because it is not safe to have a mounted partition run in a Virtual Machine. win10.mbr is from dd if=/dev/nvme0n1 of=win10.mbr bs=512 count=1.
Changed permissions to allow read/write access to
/dev/nvme0n1and the produced files (win10.vmdkandwin10-pt.vmdk) for my user.Created the Virtual Machine in VirtualBox with
win10.vmdkas Writethrough Hard disk with NVMe controller. Also, enabled UEFI.Changed the VM's hardwareuuid to mine.
This, of course, boots me into UEFI cli because there is no boot partition mounted.
Copied boot partition into a
.iso:dd if=/dev/nvme0n1p1 of=boot.isoSet the
boot.isoas an optical disk for Virtual Machine and booted. This boot into grub-cli because it couldn't find Linux installation (good because I don't want to risk data-loss by accessing a mounted partition)Booted Windows 10 EFI from grub cli, but when Windows 10 is loading, it blue screens saying that the boot partition is inaccessible (optical disk is read-only in VirtualBox, so it makes sense)
So how to I have a copy of my current boot partition used for booting the Windows 10 Virtual Machine? I was thinking of somehow making the first partition of the .vmdk point to a .img file, partition 2, 3, and 4 point to the actual partitions, and the 5th partition will point to nothing (because that is the Linux partition and I don't need it, especially since it comes with the risk of data loss). Of course, another solution that accomplishes the same goal is great too.