I use Linux as my daily driver, and have just installed Windows 10 to a new physical disk in my PC for dual booting. For a while, I’ve used Windows 7 through a VirtualBox image I have mounted over iSCSI1.
Now I have two different Windows environments and that’s very frustrating. I would love to abandon the Windows 7 VM and access the Windows 10 installation directly through VirtualBox for convenience, but without losing the ability to drop down to dual boot when I need raw-metal performance.
Is it possible to boot an existing installation of Windows 10 on dedicated physical media (internal SATA3 SSD) through VirtualBox without losing the ability to dual boot as well?
If it makes matters more complicated (or impossible) it’s worth noting that the Windows 10 SSD is protected with FDE via VeraCrypt.
Solution:
Yes, it is possible.
- Configure the virtualbox to use your physical disc. It is a little bit risky, because the VM guest will see your host disc directly. Details here.
- Give direct read/write access to yourself to your physical disc (
setfacl -m u:yourusername:rw /dev/sda
) - Update your virtualbox VM to use the same system uuid as your host (
dmidecode -s system-uuid
shows your system uuid,vboxmanage modifyvm your-vm-name --hardwareuuid <your-hardware-uuid>
). You may need to clone also your drive controller uuids (lsblk --nodeps --no name,serial
shows the serial ids of your host. I didn’t need to clone them into my virtualbox, but it may be needed. Probably some trickyvboxmanage modifyvm
command does it, or you have to edit the vm config xml manually. - Try to set up the same disc and dvd controller types in the VM as your host (if your host is SATA-based, use SATA virtual controllers, if it is IDE based, use IDE ones, etc).
There is another danger: if you boot in a VM your host drive directly, it is possible that you boot the same OS twice. Or you open the same partition twice. This will kill your data, so never mount multiple partitions concurrently. Furthermore, don’t mount your NTFS partitions while they are used by your Windows (but you can still share data between your partitions, for example with Samba).
If it accidentally happened, reboot with sysrq (alt+printscreen+b) and fsck everything. Some grub trickery may be also needed for that (I reconfigured grub to boot the windows by default, thus I avoid the problem that I boot accidentally my Linux again inside the Windows VM – and it will surely happen, because Windows Update often restarts your Windows behind your back).
Beware: Win10 uses your system uuid and your drive controller uuids to identify your PC. If you miss (3), your win10 will think it was cloned to a new machine, and it won’t be activated any more. Although if you boot back to your original hw, it will be activated again.