[PLUG] Grub cookbook for Linux?
Keith Lofstrom
keithl at kl-ic.com
Thu Oct 30 07:40:02 UTC 2003
Keith> Right now, specifically, I am looking for how to prepare a
Keith> "third party" drive. I am building a boot drive for target
Keith> machine A. I am temporarily mounting it as the second drive (
Keith> /dev/sda ) on workshop machine B. So the boot information goes
Keith> into temporary /dev/sda, points at /boot/grub/grub.conf on what
Keith> will be /dev/hda1 on the target machine A, and grub itself is
Keith> running on /dev/hde1 on machine B. I would like to do this
Keith> from the command line.
Russell replies:
>Have you tried just:
>
> mount /dev/sda1 /mnt
> grub-install --root-directory=/mnt /dev/sda
Actually, I did try something very much like that, and it failed. It
turns out that grub-install is flawed. But grub-install is a shell
wrapper for "grub --batch", and I got what I wanted by embedding
similar commands into my own shell script, like so:
/sbin/grub --batch --device-map=/dev/null << EOF
device (hd1) /dev/sda
root (hd1,0)
setup (hd1)
quit
EOF
Grub-install cannot be made to produce the "root (hd1,0)" line. It will
only produce "root (hd0,0)" . That's OK, feeding grub directly works
fine and removes a dependency on the behavior of grub-install.
This is part of my automatic restore script, which is working fine EXCEPT
for what appears to be a usb2 bug. I have some ideas about fixing the
bug - when that is done, I will post the whole restore script. With the
usb2 flaw fixed, a bare restore of the server will consist of [1] putting
a new drive in a cage, [2] rebooting the server with the backup drive in
the main slot and the new drive in the usb2 backup slot, [3] adjusting
partition sizes in a table for differences between new and old drive size
[4] starting the restore script [5] going to a movie, since the restore
script takes about 2.5 hours for 60GB of data on the server [6] swapping
the drives [7] rebooting with an exact image of the server drive as of
the last backup time.
Keith
--
Keith Lofstrom keithl at ieee.org Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs
More information about the PLUG
mailing list