3

I have a Win7 x64 & Ubuntu 11.10 x64 dual boot setup on a single HDD.

I wanted to run the native Ubuntu as a guest OS inside VirtualBox running on Win7 host.

I used the following command to list the partitions:

C:\ >vboxmanage internalcommands listpartitions -rawdisk \\.\physicaldrive0
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /32 /33  153 /27 /2           1200         2048
2       0x07  153 /27 /3   1023/254/63        363337      2459648
5       0x82  1023/254/63  1023/254/63          9537    746575872
6       0x83  1023/254/63  1023/254/63         46430    766107783
7       0x83  1023/254/63  1023/254/63         46431    861200384
4       0x07  1023/254/63  1023/254/63         10000    956291072

Then I created the vmdk file as follows (specifying the ubuntu partitions 5,6 & 7):

C:> vboxmanage internalcommands createrawvmdk -filename "C:\ubuntu_01.vmdk" -rawdisk \.\physicaldrive0 -partitions 5,6,7


The vmdk file was created successfully, but when I created a VM and specified this virtual drive, the VM wont start, theres just a blank black screen with a white cursor at the top left corner. It doesnot even show up the Grub boot menu.

Then I created another vmdk file without specifying the partitions.

C:> vboxmanage internalcommands createrawvmdk -filename "C:\ubuntu_02.vmdk" -rawdisk \.\physicaldrive0

This time the VM starts and ubuntu boots successfully from inside the VM (the grub 2 boot menu is presented and on selecting Ubuntu, it boots successfully).

How can I use only the specific native ubuntu partitions for the guest ubuntu OS ? Please help.

Host: Win 7 x64
Guest: Ubuntu 11.10 x64
Vbox version: 4.1.6 r74713 with latest guest additions installed.

1 Answer 1

1

I found a perfectly working workaround. sda7 is the partition where I installed linux, 5,6,7 are the native partition I want to virtualize, and "ceztko" is my home :P

  • from the native linux, reinstall the grub to the native linux partition: sudo-grub install --force /dev/sda7
  • copy the partition boot sector to your home: # dd if=/dev/sda7 of=/home/ceztko/virtualbox-native.mbr bs=512 count=1
  • copy virtualbox-native.mbr to your windows installation
  • Reboot to Windows and from Administrator prompt:

    VBoxManage internalcommands createrawvmdk -filename C:\users\ceztko\ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 5,6,7 -mbr c:\users\ceztko\Dropbox\resources\virtualbox-native.mbr

  • Run VirtualBox and assign the new virtual drive to the virtual machine.
  • Enjoy!

This may be a bug in Virtualbox. But better I guess is a bug in grub, confused by the non-accessible Windows partitions when installed as mbr in the boot disk.

You must log in to answer this question.

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