[CentOS] CentOS 5 grub boot problem

Thu Aug 6 23:15:23 UTC 2015
Gordon Messmer <gordon.messmer at gmail.com>

On 08/06/2015 02:19 PM, Chris Murphy wrote:
> stage 1 cannot point to another drive at all. It's sole purpose is to
> find stage 2, which must be on the same drive. Stage 1.5 is optional,
> and I've never seen it get used on Linux, mainly because in the time
> of GRUB legacy, I never encountered an installer that supported XFS
> for /boot.

Grub's documentation is slightly unclear about that.  Here's a system 
where /boot is part of a RAID1 set on /dev/vdc1 and /dev/vdd1:

    [root at localhost ~]# cat /boot/grub/device.map
    # this device map was generated by anaconda
    (hd0)     /dev/vda
    (hd2)     /dev/vdc
    (hd3)     /dev/vdd
    [root at localhost ~]# grub
    Probing devices to guess BIOS drives. This may take a long time.


         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,0)
    root (hd2,0)
      Filesystem type is ext2fs, partition type 0xfd
    grub> setup (hd0)
    setup (hd0)
      Checking if "/boot/grub/stage1" exists... no
      Checking if "/grub/stage1" exists... yes
      Checking if "/grub/stage2" exists... yes
      Checking if "/grub/e2fs_stage1_5" exists... yes
      Running "embed /grub/e2fs_stage1_5 (hd0)"...  27 sectors are embedded.
    succeeded
      Running "install /grub/stage1 d (hd0) (hd0)1+27 p
    (hd2,0)/grub/stage2 /grub/grub.conf"... succeeded
    Done.
    grub>


I believe the final line can be interpreted as:

0: install: the install command
1: /grub/stage1: path to the stage1 file, relative to the root
2: d: grub will look for stage2_file at the address specified in arg 4
3: (hd0): grub will be written to the first block of (hd0), currently 
mapped to /dev/vda
4: (hd0)1+27: stage1_5 has been embedded to this location.  It is being 
used as "stage2_file"
5: p: the first block of stage2 will be modified with the value of the 
partition where stage2_file is found
6: (hd2,0)/grub/stage2:
7: /grub/grub.conf: because this arg is present and #4 is really a stage 
1.5, the stage2 config file is patched with this configuration file name.

If I specify "root (hd3,0)" in the grub shell, the boot loader will 
differ at 0002032, where it will refer to BIOS device 3 instead of BIOS 
device 2 for the location of /grub/stage2.

--- vda.2    2015-08-06 16:05:32.039999919 -0700
+++ vda.3    2015-08-06 16:05:59.441999927 -0700
@@ -53,7 +53,7 @@
  *
  0001760  \0  \0  \0  \0  \0  \0  \0  \0 002  \0  \0  \0 032  \0 002
  0002000 352   p   "  \0  \0  \0 003 002 377 377 377  \0  \0  \0 \0  \0
-0002020 002  \0   0   .   9   7  \0 377 377  \0 202   /   g   r u   b
+0002020 002  \0   0   .   9   7  \0 377 377  \0 203   /   g   r u   b
  0002040   /   s   t   a   g   e   2       /   g   r   u   b   / g   r
  0002060   u   b   .   c   o   n   f  \0  \0  \0  \0  \0  \0  \0 \0  \0
  0002100  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0 \0  \0

...unless I'm mistaken.  :)