16

I am looking for something similiar to Bootcamp.

Currently, I run Ubuntu Maveric as my primary operating system and run Windows 7 in Virtualbox. For some tasks, however, running Windows virtualized just seems to result in too much overhead and speed loss, and I'd like to be able to boot natively.

The ideal situation would be to setup Windows and Ubuntu in dual boot on seperate partitions, with the ability to boot the Windows partition in Virtualbox on Ubuntu as well.

Is this possible?

Also, how it is that Bootcamp seems to be the only system capable of this?

4 Answers 4

16

It is possible to boot your Windows installed on your computer in a VM running on a Linux installed on the same computer. The only thing to remember: do not mount a partition on both OS. I've used this setup in qemu, kvm and VirtualBox.

EDIT: The ideea is to use the entire physical disk and be careful not to mount the same partition twice (like booting the same OS twice, or trying to mount a partition from an OS that was hibernated) VirtualBox setup:

  • Create a VMDK file pointing to a raw disk: VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -register See: http://www.virtualbox.org/manual/ch09.html#rawdisk
  • create a new VM and use the raw disk for that VM.
  • unmount all partitions that will be used by VM.
  • boot the VM and in the Grub menu chose an OS that is not already booted.
16
  • Could you elaborate on this? I am very interested in the how aspect. Mar 1, 2011 at 15:05
  • I've updated the answer. Mar 1, 2011 at 16:30
  • Thanks! Out of curiosity: what would actually happen if I'd dual-mount a disk? Mar 2, 2011 at 17:00
  • You can have filesystem corruption. But there are filesystems that allow to be mounted by two different machines (e.g. GFS). See: en.wikipedia.org/wiki/Global_File_System Mar 4, 2011 at 22:05
  • 1
    The corruption is caused by the fact that part of the filesystem state is keept in the memory of each kernel. For example the dirty pages are kept in memory for few seconds and meantime the other kernel can change the same files, jurnal or fs structure at the same time. For example you delete a file from one OS and meantime the other OS will create another file in the same folder. Because the 2nd OS has a older copy of the folder cached in memory, it could write it to disk with the cached info (first file not deleted) and new file added. The firs OS fill not notice the added file. Mar 4, 2011 at 22:12
0

Right now, there's no specific support for sharing a bootable partition with a VM. There's been some attempts at coercing VirtualBox into doing this on Macs w/ BootCamp, but it looks like a very difficult to accomplish and fragile process.

If you search the VirtualBox forums, you can find out what kind of success others have had. If this is something you intend to use in any kind of production environment, I'd wait until Oracle is at least attempting to implement it as a usable feature before trying to use it.

I know that Parallels Desktop for the Mac provides explicit support for sharing a VM with a BootCamp partition, and it's very easy to set up. So as far as it being possible to do, then yes. I don't know if they provide the same feature for their Windows and Linux products or not. It'd be worth a look.

0

I would suggest this is almost certainly not possible, or at least practically infeasible. Even if you could find a way to either boot natively from a VirtualBox image, or to boot a VB guest from a real partition (the latter is possible, I think), you'd still face the issue of the underlying hardware platform changing massively every time you switched. That at least would break your activation in a fairly short order.

0

VMWare Workstation used to be capable of something like that, but it has been ages I used this so I don't know if (a) the function still exists and (b) it would work with modern Windows versions and their activation crap.

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