I had a RHEL machine booting from local disk.

Later I removed local disk & booted from a SAN disk and installed RHEL on it.

Now I have read about a grub.conf file:

root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.2-34-default root=/dev/hda1 vga=0x317 showopts
    initrd /boot/initrd-2.6.18.2-34-default

Grub stage1 boots from MBR and then when it goes to Stage2 it takes these entry parameters.

What is the simplest way to set and choose which OS the machine will boot from?

up vote 2 down vote accepted

When grub goes to stage 2, it will present the kernel selection menu.

The best way to configure this is to use either the SAN disk or the local disk as your MBR (master boot record) then update the /boot/grub/grub.conf file to include both stanza entries from the local HDD and the SAN disk.

Then use the default=0 entry to set the default OS kernel to load.

default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.2-34-default root=/dev/hda1 vga=0x317 showopts
    initrd /boot/initrd-2.6.18.2-34-default
### SAN stanza entry ###
root (sd0,0)
    kernel /boot/vmlinuz-2.6.18.2-34-default root=/dev/sda1 vga=0x317 showopts
    initrd /boot/initrd-2.6.18.2-34-default

The second entry will be default=1.

Note
It may be better to boot from the SAN disk as you will be using the UEFI to load the fibre storage.

Manually editing grub

If you are unsure the local device number then you can go to the command-line entry when presented with the grub menu at boot time:

If you have the hiddenmenu setting in your grub.conf then it will say something similar to:

Booting from Red Hat 2.6.18.2-34... in 3 seconds ....

Press Esc to get to the menu:

Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, 'a' to modify the kernel arguments
before booting, or 'c' for a command-line.

At this point you can enter c and enter various root settings to get the correct disk setting:

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

References

Using-grub-to-overcome-boot-problems

  • In my case now i have 2 /boot one on san & other on local HDD .. Which / boot i should put this entry – Ashish Nov 6 '14 at 12:40
  • Best practice will be to boot from the local disk, so once you have the grub.conf stanza entry from the SAN OS, then add it to the local disk grub.conf. Set your bios to use your local disk then test to ensure you can choose the SAN entry in the grub menu to load. Once this tests ok, I suggest you edit both grub.conf files so you have options. – geedoubleya Nov 6 '14 at 12:44
  • May be os native name of disk may differ. Has to check with e2label & then maybe we can add associated entry for local hdd boot – Ashish Nov 6 '14 at 12:50
  • If default 0 fails then does it will switch to default 1 automatically ?? – Ashish Nov 6 '14 at 12:52
  • No, you will have to manually override it through the console, when the menu loads, you will have an oportunity to interactively move the selection with the keyboard arrow keys then enter. At this point you can edit the configuration too. As soon as you move the cursor, the timeout will stop. Use e to edit the selection. Excelent article: Grub boot edit – geedoubleya Nov 6 '14 at 12:54

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.