18

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.

4
  • 1
    I would love it if it were possible, but I haven't found a way yet. Apart from the problem of running a VM with a physical disc, there are two aspects of switching between hard and virtual boot. (1) There will be major driver reconfiguration whenever you switch run environments. (2) As a corollary, Windows will probably need licence reactivation on each switch: if this is even possible, licensing will almost certainly complain after a couple of reactivations. What you can do is create a virtual disc from a physical installation, but again licensing will be a likely problem.
    – AFH
    Commented Jan 25, 2017 at 19:06
  • You may do better to consider running the Linux installation in a Windows VM: at least it will avoid licence difficulties.
    – AFH
    Commented Jan 25, 2017 at 19:09
  • 1
    @AFH The license problem can be solved by cloning the host hardware uuid and the disc controller serial ids into the VM. It enables to run Windows once from VM, and once directly (although the m$ licensing still doesn't allow to use multiple installations with the same product key concurrently, so it can be done exclusively in the asked configuration).
    – peterh
    Commented Jan 26, 2017 at 16:19
  • @peterh - Thanks: I didn't know that UUID cloning was sufficient for Windows licensing. There remains the driver reconfiguration problem on switching. I shall experiment with your answer when I have time.
    – AFH
    Commented Jan 26, 2017 at 16:36

3 Answers 3

11

Yes, it is possible.

  1. 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.
  2. Give direct read/write access to yourself to your physical disc (setfacl -m u:yourusername:rw /dev/sda)
  3. 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 tricky vboxmanage modifyvm command does it, or you have to edit the vm config xml manually.
  4. 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.

7
  • I did everything you wrote in your answer, but I am getting an access denied error. I am a little confused, it appears that the setfacl is not holding after reboots. Suggestions? Note: I am not mounting the drive, because I do not want data corruption. ACL documentation says that the drives needing ACL should be included in fstab, which would mount it...
    – Kartik
    Commented Aug 7, 2017 at 1:00
  • 1
    @Kartik Right, it doesn't hold. The simplest, but a little bit dirty solution is to insert the setfacl command into your /etc/rc.local . The pretty good solution would be to edit it into /etc/udev . I personally don't reboot enough often to make the typing of this command annoying.
    – peterh
    Commented Aug 7, 2017 at 1:04
  • I used udev to set the correct permissions, but the virtual machine is stuck at the Windows logo. Any ideas?
    – Kartik
    Commented Aug 7, 2017 at 2:49
  • 1
    The failure to boot was caused by update 1703, or the Creator's Update as Microsoft calls it. Rolling back this update fixed the issue. VMs are incompatible with this update. If Windows updated when running on metal, then rolling it back fixes the stuck boot in VM.
    – Kartik
    Commented Aug 9, 2017 at 3:55
  • 1
    @Kartik Update to your comment from 2020: I can boot win10 in qemu and vbox long-long ago without any problem.
    – peterh
    Commented Jan 22, 2020 at 0:32
3

I succeeded with windows 10 as guest and linux mint as Host.

First you have to unistall all windows 10 updates (just in case, maybe useless) then : Under linux open a console and line by line :

 sudo su

 fdisk -l # looking for EFI et Microsoft basic data for me 1 and 3 of sdb 

 VBoxManage internalcommands createrawvmdk -filename /home/borto/ww10.vmdk -rawdisk /dev/sdb -partitions 1,3 -relative

Add machine in virtual box (always with "sudo virtualbox" to be root) and enable EFI in system tab, and choose windows xp 64 instead of windows 10 else you juste have a beautifull frozen windows 10 flag. That is all.

0
0

This is a bit old, but I found a resource that may help: https://www.howtoforge.com/tutorial/configuring-a-single-ubuntu-installation-as-a-dual-boot-option-and-a-virtualbox-appliance-under-windows-10/

1
  • Please include all relevant information directly in your answer. From the title, this appears to be the opposite of what OP is trying to achieve.
    – Daniel B
    Commented Sep 13, 2022 at 5:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .