[CentOS] CentOS 5 grub boot problem

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

On 08/05/2015 04:41 PM, Chris Murphy wrote:
> I do not know why there's a duplication of the install command.
...
>    : Running... ['/sbin/grub', '--batch', '--no-floppy',
> '--device-map=/boot/grub/device.map']
>    : grub> device (hd0) /dev/vdb
>    : grub> root (hd0,1)
>    : grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0,1)
> /grub/stage2 p (hd0,1)/grub/grub.conf

"device (hd0) /dev/vdb" overrides the data in device.map and instructs 
the grub shell to examine vdb where subsequent commands refer to (hd0).

"root (hd0,1)" sets the location where grub will look for the required 
files, probably stage1, stage2, and e2fs_stage1_5.

"install ..." checks for required files and writes a modified copy of 
stage1 to the first block of the device following 'd'.  In your case, 
that should be the first partition on vdb.

https://www.gnu.org/software/grub/manual/legacy/grub.html#install

>    : Running... ['/sbin/grub', '--batch', '--no-floppy',
> '--device-map=/boot/grub/device.map']
>    : grub> root (hd0,1)
>    : grub> install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0,1)
> /grub/stage2 p (hd0,1)/grub/grub.conf
>

This will do the same thing, except that it will operate on /dev/vda.

In both cases, stage1's block list will refer to BIOS device 0 for the 
location of stage2, so that if the BIOS boots from that drive, grub will 
load stage2, and then the kernel and initrd from the same drive.  That's 
not necessarily the case, though.  Stage 2 could be on a different drive.