Booting to alternate disk using GRUB

Posted on 2006-05-30
Medium Priority
Last Modified: 2010-04-20
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?
Question by:PsiCop
  • 2
  • 2
LVL 12

Accepted Solution

Heem14 earned 2000 total points
ID: 16791131
You can do this quite easily.

  a no
  b not needed
  c no worries ;)

  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)

LVL 12

Expert Comment

ID: 16791143
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
LVL 19

Expert Comment

ID: 16799474
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.

LVL 34

Author Comment

ID: 16800517

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.
LVL 34

Author Comment

ID: 16818380
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.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question