Booting to alternate disk using GRUB

Posted on 2006-05-30
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
    LVL 12

    Accepted Solution

    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

    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

    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


    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now