Upgrading to Lion on OSX/openSUSE dualboot using rEFIt and hybrid MBR.

Upgrading OS X from Leopard to Snow Leopard went smoothly and didn’t affect dual and triple boot that use rEFIt (such as bootcamp setups needed to boot Windows XP and Linux EFI unaware boot loaders). OSX Lion however creates a new partition, as shown is the example below.

OS X Leopard/Snow Leopard + openSUSE:

# fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00002652

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      409639      204819+  ee  GPT
/dev/sda2          409640   352469031   176029696   af  HFS / HFS+
**/dev/sda3   *   352731176   488134983    67701904   83  Linux**

OS X Lion + openSUSE:

 fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00002652

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1      409639      204819+  ee  GPT
/dev/sda2          409640   351461631   175525996   af  HFS / HFS+
/dev/sda3       351461632   352731175      634772   ab  Darwin boot
**/dev/sda4   *   352731176   488134983    67701904   83  Linux**

Obviously Linux won’t boot anymore. But rEFIT is untouched and still shows the Linux boot entry. All you have to do is to reinstall Grub in the Linux partition from Live CD (which has become sda4) and edit /boot/grub/menu.lst accordingly.

I don’t know what would happen to Windows (usually sda4) on a triple boot … but I don’t see how it could work, since there is only room for 4 partitions in the hybrid MBR. I would say that it is not possible … but I haven’t try (and I don’t think I will). Actually it should be possible to create logical partitions on EFI/GPT with a hybrid MBR … but who does that?

Reinstalling Grub:


**# grub**

   GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

  Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename. ]

grub> **find /boot/grub/stage2**
 (hd0,3)

grub> **root (hd0,3)**
 Filesystem type is ext2fs, partition type 0x83

grub> **setup (hd0,3)**
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0,3)"... failed (this is not fatal)
 Running "embed /boot/grub/e2fs_stage1_5 (hd0,3)"... failed (this is not fatal)
 Running "install /boot/grub/stage1 (hd0,3) /boot/grub/stage2 p /boot/grub/menu.lst "... succeeded
Done.

grub> **quit**

Editing /boot/grub/menu.lst:


# Modified by YaST2. Last modification on Tue Jan 17 18:32:40 PST 2012
# THIS FILE WILL BE PARTIALLY OVERWRITTEN by perl-Bootloader
# Configure custom boot parameters for updated kernels in /etc/sysconfig/bootloader

default 0
timeout 8
gfxmenu (**hd0,3**)/boot/message

###Don't change this comment - YaST2 identifier: Original name: linux###
title Desktop -- openSUSE 11.4 - 2.6.37.6-0.11
    root **(hd0,3)**
    kernel /boot/vmlinuz-2.6.37.6-0.11-desktop root=/dev/disk/by-uuid/555e2b4d-716d-46d5-a871-a3703675dcb8 splash=silent quiet showopts vga=0x345
    initrd /boot/initrd-2.6.37.6-0.11-desktop

###Don't change this comment - YaST2 identifier: Original name: failsafe###
title Failsafe -- openSUSE 11.4 - 2.6.37.6-0.11
    root **(hd0,3)**
    kernel /boot/vmlinuz-2.6.37.6-0.11-desktop root=/dev/disk/by-uuid/555e2b4d-716d-46d5-a871-a3703675dcb8 showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset x11failsafe vga=0x345
    initrd /boot/initrd-2.6.37.6-0.11-desktop

###Don't change this comment - YaST2 identifier: Original name: hard_disk###
title Hard Disk
    rootnoverify (hd0,0)
    chainloader +1
###Don't change this comment - Added by updategrub Thu Jan 26 01:30:02 PST 2012###