Installing GRUB on guest disk

Larry Cook lcook at sybase.com
Sat Apr 3 13:39:00 EST 2004


Michael,

>    For reasons I don't want to go into, my only approach is
>    to install the systemH disk as a second drive in systemG
>    and operate on it from there.

If systemH can boot from floppy, you could make a GRUB boot floppy and use 
that to (re-)install GRUB.

>    In other words, it'll
>    be /dev/hdb while installed in systemG for re-grubbing,
>    but it'll be /dev/hda once it's back in systemH.

I recently replaced my hard drive and had to do something similiar.  What I 
did was put my new disk in as /dev/hdb, created the exact same partitions, and 
then used dd to copy the partition contents from /dev/hda.  I then used the 
GRUB program to write the MBR to /dev/hdb.  I then made the new disk /dev/hda 
and was back in business.

Unfortunately I not positive of the command sequence I used.  I do rember that 
I didn't get it right the first time and had to retry.  I'm thinking I used 
the "root" and "setup" commands.  My mistake the first time was with the 
parameters to the commands.  I think the following should work:

   root(hd0)
   setup(hd1)

The root command can take a second parmeter for the partition.  I may have 
done that because you want to be specify the partition with the grub 
directory.  And I may have used hd1 as the first parameter to root.  Sorry 
that my memory is so bad.  You might want to refer to the GRUB manual on the 
gnu.org site.  I think I was using the "Install GRUB natively" section.

>    To further complicate things, the disk in question has
>    a dedicated /boot partition and the local custom is
>    to keep things in a /grub subdirectory therein (ie.
>    when that partition is mounted as /boot that /grub
>    directory becomes /boot/grub) and that's where we want
>    all the GRUB files to end up.

Yes, that sounds like the stardard according the the GRUB manual.  If the 
directory isn't already on the disk, you should be able to copy them from the 
good disk.

Larry




More information about the gnhlug-discuss mailing list