LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 07-21-2008, 03:55 PM   #1
Woozle
LQ Newbie
 
Registered: Aug 2006
Location: Sutton, Surrey, England
Posts: 14

Rep: Reputation: 0
How do I install GRUB on both MBRs of a two disk RAID1 array (Ubuntu server)?


Hi, All

I'm very new to Linux but have set myself some goals and am learning as I go.

I have installed Ubuntu Server 8.04 on a new server with two SATA disks configured as RAID1. There are several partitions on each disk, the first one on each disk set as bootable. ('dev' and 'boot' both appear under '/', which is on the first partition)

The server boots fine via GRUB and runs ok.

/proc/mdstat shows md0 thru to md5, listed as sda1, sda5, sda6,sda7, sda8, sda9, and similarly for sdb1, sdb5, etc. and each one shows as active raid1 [UU]. So far so good.

What I want to do now is install GRUB on the 2nd disk and make other necessary config changes so in the event the 1st disk fails then I can still boot off the 2nd disk.

I ran:
$ sudo grub-install /dev/sdb1
It returned several lines including 'Installation finished. No errors reported'. It also reported device.map as set to:
(hd0) /dev/sda
(hd1) /dev/sdb


To double-check I ran:
$ cat /boot/grub/device.map and it returned...
(hd0) /dev/sda
(hd1) /dev/sdb


I believe that my next step is to run GRUB and then do this:

(1st disk, 1st partition)
device (hd0) /dev/sda
root (hd0,0)
setup (hd0)


(2nd disk, 1st partition...as under failure of 1st disk then the 2nd one would become the first one!)
device (hd0) /dev/sdb
root (hd0,0)
setup (hd0)


However when I run device (hd0) /dev/sda I get returned:
Error 15: File not found

Alternatively, if I run root (hd0,0) I get:
Error 21: Selected disk does not exist

So what am I doing wrong? I suspect it's a fundamental error probably due to my newbie-ness, but I can't seem to suss it out.

Any help here much appreciated. Thanks.
 
Old 07-21-2008, 04:22 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,549
Blog Entries: 12

Rep: Reputation: 177Reputation: 177
There are a couple of ways to go about this, I suppose. Personally, I've never been a fan of grub-install and the "device" command, and prefer to use a boot floppy or CD to install grub from the grub prompt. However, you used it successfully to install grub on sdb1, and you say you are successfully booting the system using grub. What does your menu.lst look like?
 
Old 07-23-2008, 06:02 AM   #3
Woozle
LQ Newbie
 
Registered: Aug 2006
Location: Sutton, Surrey, England
Posts: 14

Original Poster
Rep: Reputation: 0
This is what was installed by the system...
Code:
default    0
timeout    5
hiddenmenu

title      Ubuntu 8.04, kernel  xxxxxx-server
root       (hd0,0)
kernel     /boot/vmlinuz-xxxxxx-server root=/dev/md0 ro quiet splash
initrd     /boot/initrd.img-xxxxxx-server
quiet

title      Ubuntu 8.04, kernel  xxxxxx-server (recovery mode)
root       (hd0,0)
kernel     /boot/vmlinuz-xxxxxx-server root=/dev/md0 ro single
initrd     /boot/initrd.img-xxxxxx-server

title      Ubuntu 8.04, memtest86+
root       (hd0,0)
kernel     /boot/memtest86+.bin
quiet

Last edited by Woozle; 07-23-2008 at 06:08 AM.
 
Old 07-24-2008, 01:53 PM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,549
Blog Entries: 12

Rep: Reputation: 177Reputation: 177
Quote:
I ran:
$ sudo grub-install /dev/sdb1
It returned several lines including 'Installation finished. No errors reported'.
Did you write sdb1 or is that a typo and you did sda1?

Try adding these lines to menu.lst:

Code:
title      Ubuntu 8.04, kernel  xxxxxx-server
root       (hd1,0)
kernel     /boot/vmlinuz-xxxxxx-server root=/dev/md0 ro quiet splash
initrd     /boot/initrd.img-xxxxxx-server
quiet
Note the change from hd0 to hd1. It should boot identically to the lines you have given your successful RAID1 install. If that works, then do the following. I presume the BIOS is set to boot off of the first SATA disk. Try switching the order in BIOS to boot off the second SATA disk to see if Ubuntu has already put Grub on both disks. If that works then you are done. If not, I would make a grub boot floppy:
http://www.gnu.org/software/grub/man...ot-floppy.html
and reinstall grub to the second SATA disk. That's done by booting the floppy, and typing
Code:
root (hd0,0)
setup (hd0)
at the grub prompt. Note that hd0 will be the first disk in boot order according to BIOS. If you switch the order you'll be installing to a different disk. If you want to install to /dev/sdb, and it's currently the second disk according to BIOS, you'll type:
Code:
root (hd1,0)
setup (hd1)
If you have no floppy drive you'll have to use a boot CD such as "supergrub"

Last edited by mostlyharmless; 07-24-2008 at 01:53 PM. Reason: typo
 
Old 07-24-2008, 02:30 PM   #5
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 958

Rep: Reputation: 35
is this a hardware or software RAID?

on a hardware raid set up as RAID1 there should be compleate transparency,
the os should only see one disk, and one MBR, each of thease will be mirrored at bit level by the hardware,

not sure exactly how software raid does this
 
Old 07-24-2008, 02:56 PM   #6
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware 14.1 (multilib) with kernel 3.15.5
Posts: 1,549
Blog Entries: 12

Rep: Reputation: 177Reputation: 177
Good question, but I'm pretty sure that it is software/fakeraid RAID from the OP's original question.

Last edited by mostlyharmless; 07-24-2008 at 03:00 PM.
 
Old 07-24-2008, 05:50 PM   #7
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Woozle if I understand you just unplug your first hd and setup your second like it was your first then plug it back in after you get your grub setup on the second drive.
 
Old 07-25-2008, 07:24 AM   #8
Woozle
LQ Newbie
 
Registered: Aug 2006
Location: Sutton, Surrey, England
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the various info, Guys. I've already explored around these areas but will revisit them and retest as I may well have missed something vital last time around. I'll report back with results. And it's a fakeraid.

Cheers for now
 
Old 08-09-2008, 04:34 PM   #9
Woozle
LQ Newbie
 
Registered: Aug 2006
Location: Sutton, Surrey, England
Posts: 14

Original Poster
Rep: Reputation: 0
Thumbs up

Success at last !

After trying various permutations and still no joy, I finally opted for running Grub from a boot cd. So I burnt off a copy of SystemRescueCD 1.0.4 and booted the machine with that.

With just one hd installed, I ran Grub and did:

Code:
find /boot/grub/stage1
...which confirmed as (hd0,0)
...and then did

Code:
root (hd0,0)
setup (hd0)
quit
I then rebooted the machine and substituted in the second hd in place of the first one, and then repeated the steps above.

Having done that I could then have either hd installed on its own and boot from it. During the boot, having got as far as
Code:
Loading, please wait...
there would be a pause of about 5 minutes and then it stated the command to run for going into degraded RAID mode, I followed the prompts and voila, I was in !

Having confirmed that both disks would boot on their own, I re-installed them together and a couple of reboots later I was back with a normally running system.

So I had a lot of learning going on there, but a successful outcome in the end. Many thanks for the pointers, Guys, much appreciated...another happy Newbie :0)
 
  


Reply

Tags
grub, mbr, raid1


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RAID1 array down to one disk with bad blocks, clone to good disk with dd noerror? ewolf Linux - Server 2 05-10-2008 12:40 AM
GRUB hard disk error on fresh ubuntu RAID install dreamer.redeemer Linux - Software 6 01-30-2008 02:33 AM
install Fedora 8 on raid1 with just one active disk iwansu Fedora - Installation 2 01-29-2008 03:13 PM
add a new disk to raid1 array retrev Linux - General 1 04-08-2007 01:57 AM
GRUB fails to install on sata disk with Ubuntu 5.04 nonutopia Linux - Software 5 08-16-2005 03:09 AM


All times are GMT -5. The time now is 02:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration