0

I got a laptop with pre-installed windows 7, and kept using this for some time along with ubuntu in dual-boot-mode.

Now I want to move the windows-7-installation into a virtual-box, running in ubuntu.

I followed serveral descriptions, but to no avail so far.

The closest I came followed this path: - on windows: create an image of the existing windows-installation using "disk2vhd" - resulting in a 60GB-File of type .vhd - on windows: create a recovery disk (DC) - on ubuntu: create a virtual machine (in virtualbox 4.3.36), assign the .vhd-File als SATA-Disk, assign the CD-Drive with recovery-disk in it as IDE-Drive. - on ubuntu: start the vm from the CD. It successfully boots from CD, finds an existing windows-7-installation with start problems, offers to repair them, does a repair with no effect.

Starting the vm without CD, boot from HD fails with: error: unknown file system Entering rescue mode grub rescue>

What is grub doing here? I think, I am inside a windows-vm. It should not know anything about being on a linux host.

Is there anything I could check to see why booting fails?

9
  • "It should not know anything about being on a Linux host." - Sounds like you are copying your host's HDD and creating a virtual HDD, which includes the boot (GRUB) partition.
    – Ramhound
    Commented Jul 3, 2018 at 13:30
  • That's a good hint! Indeed, on my original system, the windows-partition (c:/ = /dev/sda1) is marked as "boot". Any idea how to avoid it/deal with it?
    – Nicolai
    Commented Jul 3, 2018 at 14:30
  • Use a different tool to take your physical HDD and convert only a single partition to a virtual HDD, then within virtual machine create the required boot partition. I really wasn't providing a hint, i was providing an explanation, based on an assumption which you failed to confirm one way or another.
    – Ramhound
    Commented Jul 3, 2018 at 14:50
  • Checking my original HDD with gparted, I see several partitions. Only one of them is marked as "boot". This is the partition windows sits on, it is ntfs-formatted and contains /boot/BCD. Only that single partition has been converted into the .vhd-file.
    – Nicolai
    Commented Jul 3, 2018 at 14:59
  • Are we talking about GPT or MBR? While it might be marked at boot, it would be unusual for grub to be located, on the same partition as Windows (I can guarantee you that isn't the case). The boot partition in the context I used is which ever partition contains your boot manager (i.e. Grub in your case).
    – Ramhound
    Commented Jul 3, 2018 at 15:11

1 Answer 1

0

Thanks to the hints of Ramhound I found a solution.

The background seems to be that the .vhd-file contains the Master-Boot-Record (MBR) that itself contains a reference to grub.

Starting the VM from the recovery-disk, the MBR can be fixed:

  • start command prompt
  • start program "diskpart"
  • "list volume" shows available volumes in VM,
  • "select disk 1" selects volume C:/
  • "list partition" shows partions in C:/ (only one)
  • "select partion 1" selects this partion
  • "active" makes this partion active
  • "exit" leaves diskpart
  • "bootrec /fixmbr" rebuilds MBR
  • "bootrec /fixboot" rebuilds bootloader
  • "bootrec /rebuildbcd" rebuilds boot-data-table

After all these steps, the VM finally started as expected

You must log in to answer this question.

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