FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 01-24-2011, 04:00 PM
walt
 
Default grub2 for idiots like me PART 2

On 01/23/2011 02:28 PM, walt wrote:

Okay, I genuinely have grub2 installed and doing exactly what it's
supposed to do: boot your machine using only partition LABELS, not
device names/numbers...


If you got through part 1 you should have all the files you need to
install grub2 to your drive's boot block -- that's the part that is
potentially dangerous, so practice installing to a USB thumb drive
*before* you try it for real.

All of my USB thumb drives were formatted FAT16 at the factory, and
grub2 (being a bit of a pig) won't fit in a FAT16 partition table.

The answer is to reformat the drive to FAT32 or ext2, or you can use
a tool like gparted to shrink the FAT16 fs and create a new very tiny
partition for ext2. Even 3MB is big enough to hold grub -- the size
of the file system isn't important -- it's the partition table that's
too small in FAT16.

Assume you have the ext2 partition of the thumb drive mounted on
/mnt/floppy, for example, and the thumb drive is /dev/sdc.

For the actual install you need to be root because you will be
writing to the device as well as the ext2 fs on the device.

# mkdir -p /mnt/floppy/boot/grub
# /home/walt/sbin/grub-install --boot-directory=/mnt/floppy/boot/ /dev/sdc

That second step will write the actual grub2 boot block to the thumb
drive, as well as copying lots of grub modules to /mnt/floppy/boot/grub
from /home/walt/lib/grub/i386-c.

All of those grub 'modules' contain the actually code that does things
like print the boot menu on your screen and accept keystrokes from
your keyboard, search for partition LABELs, UUIDs, display boot splash
screens, play idiotic tunes, load custom fonts and fancy colors, and
tons of other stuff you won't ever want if you're still sane.

That should be enough to let you boot into the grub2 shell from your
thumb drive, assuming you set your BIOS to allow it.

Just like legacy grub, the grub2 command shell will always show you
what you can type next if you hit the tab key -- and there is quite
a long list.

The important commands to learn are 'ls', 'search', 'probe', 'help',
and 'linux'. That 'linux' command is what actually loads your kernel
from the /boot partition after you have located it with the search
and (possibly) the probe commands.

Use the help command and the tab key whenever you don't know what to
do next. You'll pick it up very quickly that way -- far faster than
trying to read any of the incomplete documentation.

One very clueful tool is the brand new utility 'grub-menulst2cfg' which
you should find in your ~/bin directory. Running that on your existing
/boot/grub/menu.lst will show you the equivalent commands for your new
/boot/grub/grub.cfg file. Very neat, and isn't included in the current
stable grub-1.98.

Once you play with the grub2 command shell you will easily see how to
use the same commands in grub.cfg because the syntax is the same.

Next time I'll explain how to use GPT (GUID Partition Table) to let
your kernel find and mount your root partition using its UUID without
an initrd. Very nifty!
 

Thread Tools




All times are GMT. The time now is 01:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org