Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my laptop, I've got a dual-boot configuration with Windows 7 and Linux OSes installed.

I am also using Linux via Oracle VirtualBox (through raw VMDK file) when working in Windows.

Since I have only one HDD, same bootloader (GRUB) instance is used in all these cases. Is it possible to somehow make GRUB choose Linux as default inside VM and choose Windows 7 otherwise?

Other options how to achieve the same behavior are also welcome.

share|improve this question
I think Ярослав Рахматуллин is correct about not using the same grub for the VM and booting your computer. When you start a VM with Virtual Box, it should automatically start the selected OS. If you are having problems automatically booting into Windows, see his post. If you are having problems booting into linux using Virtual Box, please explain your problem in more detail. – viking Jun 16 '11 at 22:06

You should probably be using a different boot device inside of your VM. You could simply create a disk image of a 5mb, and use that as your boot "drive" in the VM. Then you can install grub (or any other boot loader) there to launch Windows from your VM.

As a side note, I have to wonder how happy Windows 7 will be running off the same hard disk in a VM as well as on physical hardware... won't Windows go through some nasty identity crisis every time you change?

share|improve this answer
Thanks, it seems like it might work! I've not encountered any issues yet, I guess it's fine until they are on different partitions. – Eldar Jun 17 '11 at 0:20

Um.. I don't think you are are using the grub on your hard drive to boot the VM. Am I confusing something, or you?

anyway.. There is a default directive in grub:

# grep default /boot/grub/menu.lst 
default 3

If windows is second from the top, you would set this to 1 because 0 is 1st OS entry.

you can change the value with sed (or an interactive editor, of course):

# sed 's/default 3/default 2/' -i /boot/grub/menu.lst 

to change the value. There are experimental drivers to mount ext3 in windows, i would not recommend any of them to be honest, not sure about ext4. Perhaps there are good drivers for windows.

share|improve this answer

You must log in to answer this question.

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