Re: grub install onto a loose drive...
- From: Douglas Mayne <doug@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Sep 2006 10:01:38 -0600
On Sun, 24 Sep 2006 08:09:46 -0700, ivowel wrote:
Install grub on the external drive, per the usual drill. You will need the
sorry, I could not think of a better title.
I have a working linux system, and an external enclosure. I would like
to build a booting linux image onto a hard drive that sits in the
enclosure. my intent is to then disconnect the drive, put it into a
different computer as an internal drive, and boot it. It is of course
easy to transfer a linux partition onto the external drive. I need a
differently compiled kernel for my new computer, which I can also build
easily. this part is all easy.
boot sector stuff is not. I am now looking for instructions on how to
install grub onto the external drive, have it point at the external
hard drive's kernel (/dev/sdb1 during installation time), and realize
that although everything currently this boot sector that I want to
write sits on /dev/sdb and the root partition sits on /dev/sdb1, after
I disconnect it and put it into my new machine, /dev/sdb will become
/dev/sda.
pointers appreciated.
sincerely, /iaw
grub "stage files" on the external drive and the kernel you intend to
boot. For example, if your external drive is mounted at /mnt/sdb1 now,
create a /mnt/sdb1/boot directory and a /mnt/sdb1/boot/grub directory.
Populate the /mnt/sdb1/boot/grub directory with your existing grub stage
files, and populate the /mnt/sdb1/boot with the kernel. If you are
copying an existing setup to the external drive, then the above steps may
be redundant and not be necessary; that is, if the files were already
copied. In either case, as soon as the grub stage files are on the
target, you can setup the grub loader on the drive.
The first trick is to identify your external drive within the grub
environment. You want to ensure that grub is setup on the intended target.
The grub command "geometry" is available for help. Here is a possible
sequence (with Grub's responses omitted):
root@yourbox:~# grub --no-floppy
grub> geometry (hd0)
grub> geometry (hd1)
grub> root (hd1,0)
grub> setup (hd1)
grub> quit
root@yourbox:~#
* In the example, geometry helped to identify/verify that hd1 was the
correct target to be setup with the grub loader.
The only trick left is adjusting the menu.lst entries with correct
parameters for the boot target. grub's root will need to be set correctly,
and the kernel will need to reflect the linux root filesystem target. Here
is an example menu.lst with two stanzas (boot entries):
# Begin menu.lst
title GNU/Linux (k2.6.16.22) drive external
root (hd1,0)
kernel /boot/vmlinuz-2.6.16.22-dm1 ro root=/dev/sdb1
initrd /boot/initrd
title GNU/Linux (k2.6.16.22) drive internal
root (hd0,0)
kernel /boot/vmlinuz-2.6.16.22-dm1 ro root=/dev/hda1
# End menu.lst
Now, install the drive in the new machine and test booting. If for some
reason grub fails to load (maybe because of a bad assumption in menu.lst),
you can still use the grub shell immediately after boot. You can use "c"
and/or "e" to fixup bad entries or create a new stanza on the fly.
--
Douglas Mayne
.
- References:
- grub install onto a loose drive...
- From: ivowel
- grub install onto a loose drive...
- Prev by Date: Re: Performance problems. Your opinion please !
- Previous by thread: grub install onto a loose drive...
- Next by thread: Multiboot - with two linux OS
- Index(es):
Relevant Pages
|