bluejaybkk

Q: Virtual Box VM Linux Guest, El Capitan host...Linux is Dual Boot on the 2nd bootable partition

I have setup rEFInd to dual boot MacOSX and Linux.

My original question and solution to set that up is here

Resize Problem: Need Boot Camp Linux+ElCap, with VirtualBox VM from both

 

Now I want to be able to make

1. Linux guest virtual box vm on El Cap. But the Linux guest is actually the same Linux installed  on a separate partition, that can be dual booted up using rEFInd.

 

Problem: still not able to get the VM to boot up.

I think I need to create a grub iso to include in the VM as bootable optical drive, but I am not sure how to do it right. Please help here.

My assumption is that Virtual Box should be able to boot the Linux VM by using the grub iso (attached as optical drive)

rEFInd already works reliably (see above link) and I am able to dual boot MacOSX or Linux.

 

Here is my drive layout under MacOSX El Cap

$ diskutil list

/dev/disk0   GUID Partition    250GB

/dev/disk0s1 EFI                   210MB

/dev/disk0s2 Apple Core Storage  200 GB

/dev/disk0s3 Apple Boot Recover 620MB

/dev/disk0s4 Linux FS               20GB

 

/dev/disk1  GUID Partition    1TB

/dev/disk1s1 EFI               210MB

/dev/disk1s2 Apple FS hdd     850GB

/dev/disk1s3  Linux Swap     8GB

/dev/disk1s4  Linux FS        100GB

 

Here is my drive layout under Linux

/dev/sda1      EFI system      /boot/efi      fat32           200MB

/dev/sda2      Mac                                   hfs+           200GB

/dev/sda3     Mac Recovery HD               hfs+          620MB

/dev/sda4     Linux               /                  ext4          20GB

/dev/sdb1     EFI                                   fat32          200MB

/dev/sdb2     hdd           /media/machdd  hfs+          850GB

/dev/sdb3         swap                                             8GB

/dev/sdb4     hdd2     /media/linuxhdd     ext4          100GB

 

I tried to create the grub.iso file and put it on /media/machdd (visible to VirtualBox when El Cap is booted up)...this is where I dont know how to do it.

I also created the vmdk raw disk of the /dev/sda4 Linux partition (for VirtualBox in El Cap)...not sure if I been doing this the right way.

$ sudo vboxmanage internalcommands createrawvmdk -rawdisk /dev/disk0 -filename <vmdk on /media/machdd> -partitions 5

$ sudo chmod 777 *.vmdk

$ sudo chmod 777 /dev/disk0s4

MacBook Pro, OS X El Capitan (10.11.4)

Posted on May 10, 2016 3:16 AM