[SOLVED] How do I install GRUB on both MBRs of a two disk RAID1 array (Ubuntu server)?
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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:
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?
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
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,
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.
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.