Grub und Wechsel der Boot-Platte

Hallo

ich plane, meine Boot-Platte auszuwechseln und von einer anderen Platte zu booten. Ursprünglich ist das ein PATA-only-Rechner gewesen: die Boot-„Platte“ ist hda1. Mitlerweile ist der Rechner mit einem SATA-Conrtoller nachgerüstet, die Platten sda und sab hängen daran.

Folgendes ist im Augenblick gemounted („mount“)

/dev/hda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/mapper/vg1-home on /home type ext3 (rw)
/dev/hda6 on /tmp type ext3 (rw)
/dev/mapper/vg1-usr--lvm on /usr type ext3 (rw)
rpc\_pipefs on /var/lib/nfs/rpc\_pipefs type rpc\_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt\_misc on /proc/sys/fs/binfmt\_misc type binfmt\_misc (rw,noexec,nosuid,nodev)

Ziel: die Partitionen der Platte hda nach sdb verschieben, Platte hda
entfernen. Der Rest der größeren Platte sdb wird dann dem LVM
zugeschlagen …

Die Preisfrage: wie konfiguriere ich den Rechner, dass Grub von sdb1 startet?

Der Rechner läuft unter Debian Lenny.

# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not change this entry to 'saved' or your
# array will desync and will not let you boot your system.
default 0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 5

# Pretty colours
color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt\_x\_y\_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt\_2\_6\_8=root=/dev/hdc1 ro
## kopt\_2\_6\_8\_2\_686=root=/dev/hdc2 ro
# kopt=root=/dev/hda1 ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,0)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=

## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(single-user) single
# altoptions=(single-user mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.26-2-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.26-2-686

title Debian GNU/Linux, kernel 2.6.26-2-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.26-2-686

title Debian GNU/Linux, kernel 2.6.26-2-486
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-486 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.26-2-486

title Debian GNU/Linux, kernel 2.6.26-2-486 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-486 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.26-2-486

title Debian GNU/Linux, kernel 2.6.26-1-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.26-1-686

title Debian GNU/Linux, kernel 2.6.26-1-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.26-1-686

title Debian GNU/Linux, kernel 2.6.26-1-486
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-1-486 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.26-1-486

title Debian GNU/Linux, kernel 2.6.18-3-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-3-686 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.18-3-686

title Debian GNU/Linux, kernel 2.6.17-2-686
root (hd0,0)
kernel /boot/vmlinuz-2.6.17-2-686 root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.17-2-686

title Debian GNU/Linux, kernel 2.6.17-2-686 (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.17-2-686 root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.17-2-686

title Debian GNU/Linux, kernel 2.6.16-2-686-smp
root (hd0,0)
kernel /boot/vmlinuz-2.6.16-2-686-smp root=/dev/hda1 ro
initrd /boot/initrd.img-2.6.16-2-686-smp

title Debian GNU/Linux, kernel 2.6.16-2-686-smp (single-user mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.16-2-686-smp root=/dev/hda1 ro single
initrd /boot/initrd.img-2.6.16-2-686-smp

title Debian GNU/Linux, kernel memtest86+
root (hd0,0)
kernel /boot/memtest86+.bin

### END DEBIAN AUTOMAGIC KERNELS LIST
#
#

title Debian GNU/Linux, kernel memtest86
root (hd0,0)
kernel /boot/memtest86+.bin
savedefault

Vielen Dank im Voraus,

Sebastian

Hallo

Die IDE-Platte bleibt an ihrem Platz und somit kann auch Grub bleiben wo er ist?
Dann sollte ein Eintrag in /boot/grub/device.map helfen (Die erste Zeile steht vermutlich schon da):

(hd0) /dev/hda
(hd1) /dev/sdb

Anschließend kann der Eintrag in der menu.lst abgeändert werden, das sollte dann nicht mehr schwer sein.

johannes

Hallo,

Die IDE-Platte bleibt an ihrem Platz und somit kann auch Grub
bleiben wo er ist?

Nein, die soll dann ausgebaut werden. Da kommt dann irgendwann die nächste grössere Platte hin, der Rechner ist das Datengab.

Gruß und Dank,

Sebastian

Hi,

grub habe ich im Gegensatz zu LILO leider nie verstanden. Vielleicht kann Sebastian geholfen werden und ich gleichzeitig was lernen… :wink:

Die IDE-Platte bleibt an ihrem Platz und somit kann auch Grub
bleiben wo er ist?

Nee, hda soll ja raus, es bleibt nur sda und sdb wobei von sdb1 gebootet werden soll.

Dann sollte ein Eintrag in /boot/grub/device.map helfen (Die
erste Zeile steht vermutlich schon da):

(hd0) /dev/hda
(hd1) /dev/sdb

Heißt das, ich kann /boot/grub/device.map einfach editieren und dort die Zuordnung meiner Platten selbst vornehmen und beim installieren von Grub (wie ging das noch?) sucht sich /boot/grub/menu.lst dann in der device.map die Platten raus?

Dann müsste Sebastian also folgendes machen, ja?
/boot/grub/device.map:

(hd0) /dev/sda
(hd1) /dev/sdb

und
/boot/grub/menu.lst:

title start von sdb1
root (hd1,0)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/sdb1 ro
initrd /boot/initrd.img-2.6.26-2-686

VG,
J~

Hallo,

Die IDE-Platte bleibt an ihrem Platz und somit kann auch Grub
bleiben wo er ist?

Nee, hda soll ja raus, es bleibt nur sda und sdb wobei von
sdb1 gebootet werden soll.

Ja. Ich habe Grub dann mit „usr/sbin/grub-install /dev/sdb“ Grub in den Boot-Sektor gebracht.

Dann sollte ein Eintrag in /boot/grub/device.map helfen (Die
erste Zeile steht vermutlich schon da):

(hd0) /dev/hda
(hd1) /dev/sdb

Heißt das, ich kann /boot/grub/device.map einfach editieren
und dort die Zuordnung meiner Platten selbst vornehmen und
beim installieren von Grub (wie ging das noch?) sucht sich
/boot/grub/menu.lst dann in der device.map die Platten raus?

Nein, irgendwie nicht. Die Numerierung der Platten habe ich bis jetzt nicht verstanden. Egal: Grub startete erstmal nicht, in der Grub-Shell habe ich mit „find /boot/grub/menu.lst“ die Grub-Bezeichnung des neuen Laufwerkes herausgefunden, konnte entsprechend booten und habe dann die Datei /boot/grub/menu.lst entsprechend angepasst (insbesondere der Parameter „groot“ ist spannend), grub-update laufen lassen und fertig.

Jetzt hat die Kiste nur noch zwei SATA-Platten. Warum die Platte mit dem Kernel am zweiten SATA-Port[1] mit der Linux-Bezeichnung /dev/sdb unter Grub als hd0 und nicht als hd1 erscheint, ist mir ernsthaft rätselhaft. Möglicherweise, weil ich sie im BIOS des Rechners als erste Platte in der Boot-Reihnfolge gesetzt habe?

Gruß und Dank,

Sebastian

[1] Controller ist ein DC-4300