help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reinstalling mbr on root disk attached to a different machine


From: Frank Lin PIAT
Subject: Re: reinstalling mbr on root disk attached to a different machine
Date: Tue, 18 Nov 2008 08:08:12 +0100

On Thu, 2008-11-13 at 10:59 -0500, Radu wrote:
> I'm trying to restore the GRUB MBR on a disk that I have rebuild and on which 
> i
> have restored the 3 partitions (root, boot, swap).  The problem is that the
> disk in question is not "sda" as it would normally be during the boot process.
> It is "sdb" because I plugged the disk in a recover machine via a IDE-to-USB
> dongle.  (I have to do this because the original machine does not have CDROM 
> or
> floppy and attaching on is physically difficult.)

Ok, so you want to install grub on the disk on sdb, so the command will
start with "grub-install /dev/sdb"

You also need to tell grub, that during the boot phase, the disk will
known by the BIOS as the boot disk (BIOS "80" or what would be MSDOS'
"C:") so the /mnt/XX/boot/grub/devices.map needs to read
"(hd0)  /dev/sdb".
Finally, (IIRC), you need to give grub "--root-directory=/mnt/XX"

> The question now is how do I get grub to install on sdb (currently hd1) as 
> though
> it was sda (hd0).  I have encountered a miriad of error messages as I tried
> different scenarios.

That's the devices.map's job. update it before running the command (you
will have to re-adjust it afterward so it contains "(hd0) /dev/hda".

> My final solution, which I'm trying to avoid, is to remove the internal disk
> so that the USB attached disk comes up as "sda", at that point everything 
> works
> fine.

I don't know about CentOS, but Debian installation CD has a rescue mode,
where you can chroot in the installed CD. (Actually, it even have a
"resinstall the bootloader" option ;)

>   The question is what to do when the first disk is not the target disk.
> 
> Is there some documentation on this type of grub install or does somebody have
> experience doing this?

Since I haven't recovered such situation manually for a while, the hints
above are just what I remember... I might need to be adjusted.

Franklin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]