Booting a real Windows partition as a VM inside Linux?

I have 8.1 and Mint on the same drive on my laptop as equally sized partitions. I'm getting sick of constantly rebooting to use Sketchup or whatever on 8.1 when I could easily just use it in a VM, but also boot natively for Steam and other more involved apps that wouldn't run so well virtualized. The obvious answer is to have a separate VM for windows, but I want to complicate things :D . I want to be able to boot into my REAL windows disk in virtualbox, not just a .vdi file the traditional way.

Is this even possible? Am I crazy (I hope)?

It is possible, but as far as I know, you need to have 2 video cards. See the Debian wiki: . There might be some other workarounds, but I only know about that.

For general use, or for gaming? For steam I would just reboot into 8.1, but for general use, I don't need a dedicated GPU for the VM...

No. You don't need 2 video cards, though 2 might make things run better. You simply need to have enough video memory on the one card/"adapter" in order to share it between the host OS and any of your client OS's (the "native" real/host OS and a virtual/guest OS). The minimum amount of video memory that is typically required is usually about 128M for anything graphic intense, said with tongue in cheek since most video editors and even some games may require a whole lot more. So if your machine has a video adapter with say 256M, you would essentially be sharing half of it with your client OS assuming you go with the recommendations. (Please note also that VirtualBox usually defaults to much less video memory which is about 32K. However, it usually will be adjusted once you install the Guest OS extensions, though not always!)

As far as using a separate partition on one physical hard drive in order to mount as a VM goes, no it's not possible. That is, unless your VM client allows it somehow. I just looked at VirtualBox and it pretty much makes you use either a virtual hard drive (VHD, VDI, etc.) or a USB device but won't allow for different partitions. As far as I can see, there simply is no provision within VirtualBox to allow the mounting of a real physical partition without at least involving an adapter of some kind. That's NOT to say it can't be done! After all, you can mount real USB thumb drives and use them within a virtual OS, so I would imagine you could attach a HDD to a USB adapter and do things that way. But to do what you want while also running your native OS on the same drive does appear to be impossible. (Then again, maybe a different client allows it -- I don't know since I pretty much use Virtual Box).

Therefore, my advice would be to just run Windows natively and use a VM client like VirtualBox to run all your Linux OS's (which seems to be the way most folks are going). You can even share files between the OS's via various networking configurations too. But if that's not possible/acceptable then you would need to get Linux and Windows on at least 2 different physical hard drives (SSD, or whatever) in order to do what you want. Hope it helps.

I misunderstood the question, sorry about that.

Booting into the real partition is indeed impossible.

But if you only want windows to play games on it, and you're sick of booting into windows only for that, Qemu/KVM + vfio is a doable option (but only with 2 cards). With this method you can achieve around 95% performance. It's certainly better than using fully virtualized environment. Hence I only have one card, I couldn't test it out, but I'm sure it's great for both gaming and other purposes.

Here are some links if you are interested:

once again, sorry for the confusion.

1 Like

could you guys walk me through how to set something like this up
ill be doing a trial run on my shitty laptop first
and if i like running windows inside a linux emulation then ill do it on my main pc
so that whenever windows fubars i can just restore the last working state

With the right hardware you can set up a VGA passthrough to get nearly native performance. The problem is that you are on a laptop, which makes it very difficult (usually impossible) to reliably set up a system like this. If you have a desktop with >1 GPUs and are feeling adventurous, there are several posts in this forum and online guides on how to set up a VM with a pass-through.

the entire point of the laptop was just as a trial run so i dont screw up my pc

I use an eGPU on my laptop... Could I use passthrough on the egpu and external monitor? That would be nice... I would have to fix XOrg's bugs on my setup though first...

Since it would just be another PCI device to Xen or KVM, it might work. Give it a try.

In my experience, you can indeed use your physical drive in VM. I've previously used VirtualBox on Windows to SpinRite (HDD recovery tool) a drive while allowing me to still use my computer. This involved making a virtual drive that linked to the raw contents of the real drive. For VirtualBox on linux, here is the commant that you must use:

VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/sda#

When in the VirtualBox setup wizard, simply selecy "Do not add a virtual hard drive". Then you can mount it manually in the VM settings -> Storage -> Add Hard Disk -> Choose existing drive. From then, I'm not sure exactly how it works for booting (I imagine UEFI would cause issue). But for the needs that I had at the time, I had direct access to the drive, allowing SpinRite to do its magic without monopolising my computer for 4 days.

Now keep in mind that I will be testing this as well, because I want to achieve the same outcome: Being able to use Windows 7 on my machine, either through boot or through VM, depending on my needs. So I'll update everyone to see if I can boot in VM.

1 Like

Interesting. I'm on an older laptop that doesn't support UEFI so that might actually be an advantage here. I'll have to try this out later. Is this also possible the other way; from Windows 8.1 to Linux Mint?

So I would just use the vmdk to point to /dev/sda1 for the VM? Seems straight forward.

Another question: Will installing vbox guest additions screw with booting into 8.1 natively?

For now, further than what I've already used it for, I can't say. The only thing I can say is that you can create a virtual drive to connects to your physical drive. I'll certainly test that ability once I can get Windows 7 installed, which is a hassle because it's being mean with UEFI. But that's a problem for another forum topic.

The idea I have in mind is to install Windows 7 on another partition, configure GRUB to add Windows 7 as a boot option. After installing all of the necessary drivers on native boot, I'll head into Linux, than with VMWare (or for yourself, VirtualBox) I'll create a virtual disk that uses the physical drive. Than see if I can boot via VM.

The problems that might happen:
1. VMWare/VirtualBox might not be able to boot UEFI
2. The virtualized environement and the native environement might be so different for Windows 7 that it might not be adaptable enough to deal with the change. (Happened when I upgreaded my system from AMD to Intel, had to reinstall)
3. Drivers might not be compatible between environements (Similar to above)