Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Boot from GPT (GUID) with legacy GRUB (v 0.97 + GPT patches)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Gokhan
n00b
n00b


Joined: 01 Mar 2012
Posts: 4

PostPosted: Thu Mar 01, 2012 3:25 am    Post subject: Boot from GPT (GUID) with legacy GRUB (v 0.97 + GPT patches) Reply with quote

My first post! :D

Gentoo Linux 3.2.1-gentoo-r2 i686 installation went pretty well but the GRUB boot with GPT partitions (created with parted, as opposed to fdisk msdos partitions) was a nightmare. It would give the "GRUB Hard Disk Error" every time I tried to boot it before the GRUB screen could come on. I am using an Intel DG965WH motherboard with a Core 2 processor.

I spent hours on this but finally found a nice and easy solution:

The current Gentoo installation handbook doesn't instruct to create a boot flag for GPT (GUID) boot partitions under instructions for parted to create partitions (instead of using fdisk). In fact, parted doesn't support such a boot flag similar to that found in fdisk. The boot flags supported in parted ("set 1 boot on" or "set 1 bios_grub on") don't work with legacy GRUB (version 0.97 + GPT patches) and/or certain BIOSes.

Remedy:

(1) After creating a GPT partition table under parted, quit parted.

(2) Enter fdisk (fdisk /dev/sda). You will be warned that fdisk doesn't work with GPT. Toggle the boot flag for the boot partition using the command "a" followed by the partition number. Do not change anything else. Save and exit using the command "w".

(3) Run grub-install or grub in the chrooted environment if necessary.

Now, legacy GRUB (Version 0.97 + GPT patches) can boot from the GPT partition on all BIOSes.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31907
Location: 56N 3W

PostPosted: Thu Mar 01, 2012 6:24 pm    Post subject: Reply with quote

Gokhan,

Welcome to Gentoo.

This is a broken BIOS issue and there is a lot of it about. Most BIOSes expect to find an MSDOS disk lable, with the conventional partition table. At one time, thats all there was.
Worse, broken BIOSes check that the bootable flag is set somewhere in the partition MSDOS table and refuse to boot from the drive if its not.
BIOSes come in three groups.
Those that ignore the bootable flag entirely. This is the right thing.
Those that check the bootable flag is set on exactly one MSDOS partition table entry.
Those that check the bootable flag is set on one or more MSDOS partition table entry.
The last two are broken.

Parted copes with this to some extent by making a 'protective' MSDOS disk lable with a single partition of type EE covering either the whole disk or the first 2Tb, as thats all an MSDOS disk label can describe.

Something to be aware of and keep at the back of your mind, is that with GPT, there is no 'waste space' to hold the grub stage1.5, so the bootloader in the MBR has to load grub stage2 directly.
It does this by loading a block list build at grub install to the MBR time. As a result, if you update grub, you must reinstall it to the MBR to get a new block list. If you don't assorted strange thing happen. The best of which is that the old stage2 is used, even though the file entry for it has gone. If something else occupies the disk blocks where the old stage2 was ... well, lets just say you won't like the result.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Gokhan
n00b
n00b


Joined: 01 Mar 2012
Posts: 4

PostPosted: Thu Mar 01, 2012 8:06 pm    Post subject: Reply with quote

Thanks NeddySeagoon for the info. I will remember to rerun grub-install if emerge updates grub. I have the Gentoo minimal installation CD handy if it doesn't boot.

It looks like bootloaders and partition apps are still a little bit of a mess. Perhaps GRUB 2 will make things a little better when it becomes standard in Gentoo, but it will be a new learning curve to configure it. Hopefully they can make parted more compatible with legacy BIOSes. My Intel motherboard is not that old at all.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31907
Location: 56N 3W

PostPosted: Thu Mar 01, 2012 9:41 pm    Post subject: Reply with quote

Gokhan,

File a bug report with your findings and fix. That is that parted should set the bootable flag in the protective MSDOS partition it creates for GPT disk lables.
The idea is to accomodate broken BIOSes.

Its probably an upstream bug really, but filing at bugs.gentoo.org will get it noticed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Gokhan
n00b
n00b


Joined: 01 Mar 2012
Posts: 4

PostPosted: Fri Mar 02, 2012 1:48 am    Post subject: Reply with quote

I did submit a bug report and just placed an additional comment regarding fixing parted to include a bootable flag (for both gpt and msdos partitions).

Thanks.
Back to top
View user's profile Send private message
SProkofiev
n00b
n00b


Joined: 23 Apr 2012
Posts: 10

PostPosted: Mon Jan 21, 2013 1:22 am    Post subject: Boot from GPT (GUID) with legacy GRUB (v 0.97 + GPT patches) Reply with quote

This raises some questions for me.

I've been planning to build a new drive. I've heard bad things about GRUB2 so I plan to stick with GRUB.

I will not be using RAID as I do not need it for my machine. I am interested, but not at this time. I would
like to use LVM2, GPT and Labels and ext4. Part of this effort is educational, as well as enabling partition resizing.
I do plan on video and audio for this machine.

In a nutshell, should I avoid GPT? What I've read about it is that it is the future so I have assumed it would be good
to make use of it in a new Gentoo box.

Thanks.
Back to top
View user's profile Send private message
srs5694
Guru
Guru


Joined: 08 Mar 2004
Posts: 432
Location: Woonsocket, RI

PostPosted: Mon Jan 21, 2013 7:32 pm    Post subject: Re: Boot from GPT (GUID) with legacy GRUB (v 0.97 + GPT patc Reply with quote

SProkofiev wrote:
I've been planning to build a new drive. I've heard bad things about GRUB2 so I plan to stick with GRUB.
...
In a nutshell, should I avoid GPT? What I've read about it is that it is the future so I have assumed it would be good
to make use of it in a new Gentoo box.


On the one hand, GPT offers a few advantages over MBR, such as support for over-2TiB disks, no primary/extended/logical partition shenanigans, partition labels (names), CRCs of GPT data structures to detect problems, and backups of important data to correct problems. These are the practical reasons to use GPT, although there's also the educational factor: You're likely to use GPT on new computers that use EFI, so familiarizing yourself with GPT now will cut back on the learning curve later.

On the other hand, most of GPT's advantages are pretty minor. The biggest advantage is support for over-2TiB disks, and if you don't use such disks, that's irrelevant. As noted in this thread, there are buggy BIOSes that have problems with GPT. Such implementations are rare, but not non-existent. (These problems can usually be worked around, but doing so involves jumping through some extra hoops.) Older OSes (such as most versions of Windows XP) don't support GPT, so dual-booting with GPT can be problematic. GPT has its own learning curve, so if you're short on time, sticking with MBR may make sense.

You'll have to balance these advantages and disadvantages yourself; only you know details like what your time constraints are and what size your disks are. Chances are that either MBR or GPT will work.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum