|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a patch to fix installation of grub in case we have md raid 1 /boot
device. I posted similar patch some time ago, Hans reviewed it, but it
didn't gather much attention so I was afraid to push it - it changes behavior.
Now I decided to do things a bit differently. Also, some weeks ago Hans has
pushed a patch fixing bootloader target selection for mdraid (commit
45a7048e5f56316e052e4699b5ec70aa291ddd5e) upon which my patch is standing. So
here I come again (sorry for repeating myself).
We offer installation into mbr or boot partition (/dev/mdX) in UI. In F11 and RHEL5
if md boot partition was on /dev/sda1 and /dev/sdb1, in case of "mbr" we
installed grub twice into mbr of /dev/sda, and in case of "partition" into mbr
of /dev/sda and /dev/sdb. Member drive removal in the second case didn't work
I think (no boot).
Hans's patch changed the behavior (it was expected) - we are really installing
bootloader into boot device if /dev/mdX is selected, and if mbr is selected,
we are installing twice into mbr of selected drive as before.
My patch wants to make it behave "the right" way, that is - install where you
were asked to, and be able to boot when one member disk is removed (see bug
https://bugzilla.redhat.com/show_bug.cgi?id=213578), so:
A) In case of installing into boot partition: install it there in a way that the
boot works if one member is removed.
B) In case of installing into mbr: iff the disk contains member of boot md
array, install also into mbrs of other members. If one member is removed, be
able to boot - this is fixed by the patch.
Note: I'd like to fix upgrade of grub part too, especially when now the
behavior has changed wrt what we write out in grub.conf and
/etc/sysconfig/grub. Also UI can writing for mbr could say that we'd
install into mbr of other member disks too (if it is the case)
If you want details, below are some cases that illustrate the change (also the
code may be hard to follow for given case, I can post a test script using
which you can get resulting grub input for given case)
1) sda, sdb, install to mbr, /boot is sdb1
works both with and without the patch, the same grub commands are run
2) sda, sdb, sdc, install to mbr of sda, /boot is mdarray of sdb3 and sdc3
without the patch:
- boots with both disks, doesn't if any is removed
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,2)/grub/grub.conf
grub> Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd1,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd1,2)/grub/grub.conf
grub>
both disks - OK
2nd disk removed - OK
1st disk removed - OK
with the patch:
- boots even when any of member disks is removed
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd1,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd1,2)/grub/grub.conf
grub>
3) sda, sdb, install to mbr of sda, /boot is mdarray of sda3 and sdb3
without patch:
- it boots with both disks, doesn't find stage1 (_ on screen) if any of them
is removed
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd1,1)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd1,1)/grub/grub.conf
grub> Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd2,1)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd2,1)/grub/grub.conf
grub>
with the patch:
- boots even when one of member disks is removed
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> device (hd0) /dev/sdb
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,2)/grub/grub.conf
grub> Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,2)/grub/grub.conf
grub>
4) like 3), but /boot is mdarray of sda3 and sdb2 - notice different partition
numbers - removing a specific one of member disks can't work as location of
grub.conf file stored in first block of stage2 is shared and so contains only
the last grub-installed value.
without the patch:
- doesn't boot with both disks, doesn't boot with any single disk
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,2)/grub/grub.conf
grub> Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd1,1)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd1,1)/grub/grub.conf
grub>
with the patch:
- boots when one second disk is removed, not when the first one is removed
(in the sense of boot order)
- log:
Running... ['/sbin/grub-install', '--just-copy']
Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> device (hd0) /dev/sdb
grub> root (hd0,1)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,1)/grub/grub.conf
grub> Running... ['/sbin/grub', '--batch', '--no-floppy', '--device-map=/boot/grub/device.map']
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub> root (hd0,2)
Filesystem type is ext2fs, partition type 0xfd
grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 p (hd0,2)/grub/grub.conf
grub>
|