Grub and logical partitions

Daniel B. Thurman dant at cdkkt.com
Sat Jul 31 01:33:53 UTC 2010


On 07/30/2010 03:21 PM, Timothy Murphy wrote:
> Can grub boot from a logical partition?
>
> It seems from my reading that it cannot.
>
> But I found that I could in fact boot from /dev/sda5
> if I used grub interactively, starting with
>   root (hd0,4)
> then using tab to look for kernel and initrd
> and finally booting.
>
> However, if I put exactly the same commands in grub.conf
> the boot failed, with "File not found ...".
>
> (Nb I am not using LVM, sda5 is a logical partition
> within the extended partition sda4.)
>
> Can some guru explain this to me please.
>
>   
It can if you set the MBR for each boot partition.
For example:

#grub
grub> find /grub/stage1
hd0,4
hd0,6
hd0,8

In my setup, 4 is a front-end, MBR for the
entire drive and the boot partition has a single
grub directory with all of the stages, splash, grub.conf
and no kernel/initrc/mem/etc., nothing above the grub
directory. Just make sure that the grub directory is the
latest grub that supports ext4. The grub.conf file
contains only chainloaders such as:

title Fedora 13
    rootnoverify (hd0,6)
    chainloader +1
    savedefault

title Ubuntu 10
    rootnoverify (hd0,8)
    chainloader +1
    savedefault

As seen above, 6 is Fedora's boot partition,
7 is Fedora's root partition, 8 is Ubuntu's
boot partition (using old grub, not grub2)
and 9 is Ubuntu's root partition and so on.

To get the ball rolling one must in grub do:

grub> root (hd0,4)     # Master grub MBR
grub> setup (hd0)
grub> root (hd0,6)     # Fedora
grub> setup (hd0,6)
grub> root (hd0,8)      # Ubuntu
grub> setup (hd0,8)

So you will basically get two grub menus, one for the
master list (MBR) and the other for the selected OS
containing it's own kernel context information.

Hope this helps.



More information about the users mailing list