Virtualbox raw image with opensuse 13.2

Hello,
I’ve just switched to opensuse to replace my previous distro (Mandriva) on a dual boot configuration with Windows 7. Rather than run a separate VM (kubuntu) inside Windows for when I want to use Linux without rebooting as I have been for a while I would prefer to access my main installation from within virtual box. I have created a raw image for the relevant partitions swap,root & home (using the -partitions flag) following this guide http://lifehacker.com/how-to-dual-boot-and-virtualize-the-same-partition-on-y-493223329 but I am unable to get the grub iso to boot successfully instead just getting a blank screen.

I have tried just doing a grub2-mkrescue -o boot.iso which just gives me a grub prompt. Reading around I can just use dd to grab my mbr as I’ve done in the past when loading Linux from the Windows boot loader and provide that with the -mbr flag when creation the raw image but the article seems to suggest that is undesirable.

Can anyone provide some advice on how best to do this and get a working grub boot.iso our of another approach is recommended.

Thanks,

Morpheus

IIRC a default openSUSE doesn’t install /boot into a separate partition anymore.
A default openSUSE install layout is only root (/), User (/home) and swap (/swap).
Have you tried just pointing your boot menu to the virtual disk and not to a separate /boot iso?

TSU

Thanks TSU,
yes the /boot is part of the main root partition, I used expert partitioning to reuse my existing partition scheme and not lose the files in my home directory (I got rid of all the other config files in my home directory so it would effectively be a clean install) so I have a swap, root and home partition.

However the issue here is that I believe it doesn’t actually have a boot loader hence why the link in my original post talks about creating a boot.iso. The boot loader for the system resides in the mbr of /dev/sda and this is what launches either Windows or Linux when I dual boot but the raw partition files created by virtual box don’t contain this.

Morpheus

OK, I think I see what the author of that article is trying to do…
But, are you installing 13.2 and if you are, did you accept all the defaults?
IIRC the most recent openSUSE no longer defaults to writing to the MBR, it should now be UEFI and be all included in the /boot directory of the root partition.

So, it might work just pointing to the disk.
Here are some more suggestions…

  1. So, it occurred to me, why build a separate boot disk? Why not make the existing data disk bootable? Do a Google search and you’ll get some hits. Here is one (untried) which looks reasonable… Mount the disk on a loop device and then you can run fdisk against it, setting the bootable flag
    virtualization - Making a VDI image bootable for VirtualBox - Super User

  2. Consider your reasons for pointing Virtualbox to your raw disk file system. It’s not usually a good idea (in particular make sure nothing is accessed simultaneously and Windows is famous for accessing things when there might be little reason to do so). If you don’t mind virtualizing a <copy> of your existing physical Linux partitions, dd the partitions into a regular, empty, bootable disk file created by a normal Virtualbox “create machine.”

Last observation:
It doesn’t surprise me greatly that the reference’s instructions for creating a grub iso file might not work… It looks like a method to chainload bootloaders and grub/grub2 have undergone some changes over the past several years. But, if necessary I’d strongly recommend seeing if my Option 1 will work if you continue down this path.

TSU

Thanks,

I forgot to mention this machine is a core 2 duo with a bios rather than UEFI so the defaults put it on the MBR. My main reason is because it ensures that I keep the system up to date as I found when running a VM and a dual boot that the dual boot started to lag behind significantly.

I’ll look into your suggestions and give them a try. Thanks.

Morpheus

A variant on my Option 1,
To mount your unbootable disk as a data disk, you can always add the disk file to an existing working Guest created a normal way, then run your fdisk.

Just for those who might be unfamiliar with running losetup…

TSU