Howto boot directly into a VirtualBox image? [closed]

I have a running setup as following:

  • Native OS: Windows 7 64bit, 3 Partitions:
    • c: (System)
    • d: (FAT32, here is my vdi file)
    • e: (unformatted)
  • VirtualBox: Fedora 14 running off the vdi file on drive d.

Usually this setup is great for me, but sometimes I'd like to run Linux natively, and not inside VirtualBox.

Is there a way to boot directly into the vdi file without the Windows overhead? E.g. using a USB stick with some modified Linux Kernel / GRUB that can mount the vdi file directly as "/"? Or copy the contents of my vdi file to the empty partition and somehow use this from VirtualBox (when booting into Windows) AND directly booting into Linux?

Hope to get some hints or even howtos.


Solution 1:

I don't know if it is possible to boot a vdi file but you can convert VDI file to raw image:

VBoxManage internalcommands converttoraw Fedora14.vdi Fedora14.raw

You must remember though that this is a whole drive image, so just copying it to a empty partition won't work, you can copy using Windows version of dd to a spare disk and boot that.

If your Fedora installation is using only one partition you could skip those first sectors containing MBR and copy only the remaining stuff. This will be easily bootable using either Fedora CD or Super GRUB Disk.

All in all, I think that this is a good exercise but rather pointless. Installing Fedora natively and copying data from /home from VM (if you didn't use MySQL or other databases in the VM that's the only thing you need to copy) will be much easier and less error prone.

Solution 2:

It is possible to boot directly into Virtual PC/Hyper-V VHD files on a Windows 7 machine, but that works because Windows 7 can mount VHDs like they're physical disks. I'm not sure it would be possible using VDI, so you'd either need to convert the virtual machine to a VHD format or follow Hubert's suggestion above.

Scott Hanselman has a good article on Boot-to-VHD in Windows 7.