On 07/11/2009 08:08 AM, Alex Schuster wrote:
Alan E. Davis writes:
On Sat, Jul 11, 2009 at 11:26 PM, Neil Bothwick<[email protected]>  wrote:
On Sat, 11 Jul 2009 10:16:26 +1000, [email protected] wrote:
In grub, it is located first  as hd1 (/dev/sdb) and then as
/dev/sda5.  That is where I want it to be.

Those are two different things. the first is GRUB's root directory, the
place where is will find its configuration and stage files (i.e. the
location of /boot). The root argument on the kernel line is tell the
kernel the location of your root filesystem - /.

I need to have the second drive (SATA #2) as the first boot drive
because that's the drive with the grub setup in the MBR, for Gentoo.

Is there a reason why yo keep having grub on #2? If not, I'd just run grub,
enter
   root (hd0,0)
   setup (hd0)
   quit
, copy /boot/grub/grub.conf over and all should be fine.

If you prefer to leavy it as it is: instead of using the partiton itself
(like /dev/sda5) in grub.conf and fstab, you could try the /dev/disk-by-
label/<label of your root partition>  notation. You can use dumpe2fs -h
/dev/sda5 to see the label as Filesystem volume name, and tune2fs -L to
change it. Then it would not matter on which drive the partiton actually is.

Alan, FTR this is pretty much what I was going to suggest.  As you can see
by Alex's amended post, this is a confusing subject and it's all too easy
to make a bad mistake.

The very first thing I do before changing anything is to make a bootable
USB stick or floppy with all of the files needed to install grub, so I can't
lock myself out with my stupid mistakes.

My USB stick, e.g. shows up in grub as (hd2).  Now, I can't possibly think
straight enough to know in advance that the USB stick is (hd2), so what I
do every time is to use this trick from the grub prompt:

grub> root (hd<now I hit TAB for a list of all drives that grub finds>
grub> root (hd<TAB>
Possible disks are:  hd0 hd1 hd2   <that narrows it down to three>

Now for each of the three disks I continue this way:
grub> root (hd0,<TAB to get a list of all partitions on (hd0)>

On the third disk I finally recognize my USB stick because it has only one
partition, but just to be sure:

grub> root (hd2,0)/<TAB to get a list of all directories on the partition>

If by that time I'm still not sure which is the right disk then I'd better
go take a nap before proceeding ;o)

Now I mount the USB stick and make a new directory /boot/grub and into that
I copy all the install files from /lib/grub/i386-pc/

Now you need to install grub onto the USB stick to make it bootable:

grub> root (hd2,0)  <that's where I put the grub install files>
grub> setup (hd2)   <don't specify a partition when running setup!>
grub> quit

You can now boot the USB stick and use it to install grub on a hard disk,
and of course you can use it to boot a machine with grub improperly
installed or configured.


Reply via email to