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/nvme0n1
and the produced files (win10.vmdk
andwin10-pt.vmdk
) for my user.Created the Virtual Machine in VirtualBox with
win10.vmdk
as 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.iso
Set the
boot.iso
as 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.
-mbr
option may be related, because the GPT table is not in the first 512 bytes.PARTUUID
inblkid
). It may also be used by Windows to identify partitions. // You may want to add a proper virtual disk with the boot partition instead of putting a raw partition in the virtual optical drive.