• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Booting to alternate disk using GRUB

Suppose you have a box running Linux and using GRUB to boot. I doubt it matters, but let's say its RHEL3.0. This is a BC/DR scenario, the processes and situation are not optimal. This is about quickly recovering functionality, and not about doing things the "best" way.

This box has two physical disks - hda and hdb. Let's say they're identical size/geometry. hda has the current running OS, nothing is on hdb. Perhaps hdb has been partitioned and blank filesystems put on it, but no data. They're not necessarily even mounted (or in fstab).

Let's say I need to recover another system for BC/DR purposes. I load my tape backup software on this server (installing somewhere on hda) and can now access my backup tapes. I restore the other system to hdb - dump all the filesystems down to that previously blank drive. The system being restored is also RHEL3.0. I'm restoring / and everything else from tape.

But I didn't go thru an install. hdb has no MBR. There's an MBR and GRUB on hda. The restored system is on hdb. So how do I boot to hdb?

Remember, this is a BC/DR scenario. A manual boot process is OK, the goal is to get the restored-from-tape OS and software, dumped on hdb, booted and running.

1) About the MBR...
  a) Does the fact that hdb doesn't have an MBR make any difference?
  b) If so, is there an easy way to get one on there?
  c) If so, HOW?

2) About booting...
  a) Can I boot the OS on hdb from the GRUB on hda?
  b) If so, HOW?
0
PsiCop
Asked:
PsiCop
  • 2
  • 2
1 Solution
 
Heem14Commented:
You can do this quite easily.

1)
  a no
  b not needed
  c no worries ;)

2)
  a) YES!
  b) edit /boot/grub/menu.lst.

  you might find something like this in there: (this is from a SUSE system, but it will be similar on your rhel)

title SUSE LINUX 10.0
    root (hd0,0)
    kernel /vmlinuz root=/dev/hda4 selinux=0  resume=/dev/hda2  splash=silent showopts
    initrd /initrd



then, simply change the root  directive to hd1,0 make the kernel point to the right place in that root (probably the same) and change the root= to /dev/hdbX (wherever the root partition is)

0
 
Heem14Commented:
I'm sorry I should have clarified -

actualy copy and paste that whole block of text and make a new entry. change the title to something unique, and then you can choose via a menu upon bootup which HD you want to boot to
0
 
alextoftCommented:
Perhaps you might also consider in the future using Linux software RAID1, peace of mind and drive redundancy.

If you wanted to copy the MBR from 1 drive to another it's very easy, just use
dd if=/dev/hda of=/dev/hdb bs=512 count=1

Then unplug hda and reconfigure hdb to be the master. This however is not enough to boot the system. The part of Grub which lives on the MBR knows nothing about filesystems, and will look for its stage2 component at a certain location on the disc regardless of partitions. If you restore files from tape, the location of this file will more than likely change, so you'd need to boot up with your RHEL disc and run a bootloader repair (grub-install). Then if all is well you should be able to boot it.

0
 
PsiCopAuthor Commented:
*sigh*

alextoft, I appreciate your comments, but you evidently didn't read the original Question where I wrote "This is a BC/DR scenario, the processes and situation are not optimal. This is about quickly recovering functionality, and not about doing things the 'best' way". The scenario is quickly bringing critical systems up at a hotsite that may or may not have equivalent hardware. Yes, RAID is great, but that's not the focus here.

However, the "dd" idea is worth taking a look at. Thanks for posting it.
0
 
PsiCopAuthor Commented:
Heem14's advice was spot-on. I've successfully emulated the BC/DR environment and was able to use Heem14's suggestion to boot the recovered system.

Thanks to all.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now