LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 03-18-2008, 07:05 AM   #1
Zippy1970
Member
 
Registered: Sep 2007
Posts: 72

Rep: Reputation: 16
Question How can I get GRUB to detect the hard drives the same with each boot?


Let me try to explain my problem. I have a system with three identical hard drives. Two drives are used in a RAID 1 array, the third drive is used as a backup drive. The two RAID drives are connected to SATA 1 and SATA 2 on my computer. The third is connected to SATA 3.

Let me call the two RAID drives HDD-R1 and HDD-R2, and the backup drive HDD-BU. At boot, grub numbers them as follows:

HDD-R1: hd0
HDD-R2: hd1
HDD-BU: hd2

In my grub menu.lst, I have setup grub to first try to boot from hd0 (the first RAID drive), and if that fails try to boot from hd1 (the second RAID drive).

For testing the RAID, I simulated a fatal disk failure by disconnecting HDD-R1. The system booted fine. I then reconnected HDD-R1 and removed HDD-R2. Again in booted fine. I reconnected both HDD-R1 and HDD-R2 and tested the fallback again, but this time by simply choosing from which harddrive to boot from the grub menu. When I chose to boot from hd0, all was fine. But when I chose to boot from hd1, it gave me an "Error 15: File not found".

It took me a while to figure out what had happened.

When I first disconnected HDD-R1, grub renumbered the drives as follows:

HDD-R2: hd0
HDD-BU: hd1

It booted fine, not because grub chose the fallback boot drive, but because it simply succeeded booting from hd0, the default boot option.

When I removed HDD-R2 and reconnected HDD-R1, grub numbered the drives as follows:

HDD-R2: hd0
HDD-BU: hd1

Again, it succeeded to boot using the default boot option.

In the last test, when I reconnected HDD-R1 again, grub numbered the drives as follows:

HDD-R2: hd0
HDD-BU: hd1
HDD-R1: hd2

You can see the obvious problem here. Grub will not be able to boot from the fallback drive since hd1 no longer is the second RAID drive, but the backup drive. This of course defeats the purpose of a RAID 1 setup.

So how can I get grub to number the drives the same each and every time? Perhaps label the drives and have grub check the volume labels instead of the physical boot order?
 
Old 03-18-2008, 10:29 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,406

Rep: Reputation: 212Reputation: 212Reputation: 212
I think you need to change your point of focus. Grub doesn't do the hardware detection. The BIOS has hardware information, but it isn't passed on the the OS. So, the hardware detection is done somewhere else.

I think you should start looking into udev rules and persistent device names.
 
Old 03-18-2008, 08:45 PM   #3
Zippy1970
Member
 
Registered: Sep 2007
Posts: 72

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by bigrigdriver View Post
I think you should start looking into udev rules and persistent device names.
I'm not sure I understand how that's going to help me. Grub expects something like "hd0", not device names (like "/dev/..."). Or am I wrong?
 
Old 03-19-2008, 07:06 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2010.12, Slack1337 DebSqueeze, +50+ other Linux OS, for test only.
Posts: 9,302

Rep: Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353Reputation: 1353
You have a "dev" entrance : root=
1)example1, pclos:
title linux
kernel (hd0,0)/boot/vmlinuz BOOT_IMAGE=linux root=/dev/hda1 acpi=on splash=silent vga=788
initrd (hd0,0)/boot/initrd.img
2)example2, ubuntu7.10 :
title Ubuntu 7.10, kernel 2.6.22-14-generic
root (hd1,0)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=3334ac95-c30d-4156-b611-90f10b3d086c ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet
..........both examples from /boot/grub/menu.lst

so....good luck with finding your device-names.
 
Old 03-19-2008, 08:47 AM   #5
Zippy1970
Member
 
Registered: Sep 2007
Posts: 72

Original Poster
Rep: Reputation: 16
In:

Code:
title linux
kernel (hd0,0)
/boot/vmlinuz BOOT_IMAGE=linux root=/dev/hda1 acpi=on splash=silent vga=788
initrd (hd0,0)/boot/initrd.img
"/dev/hda1" is a kernel command-line parameter. Not a grub parameter. So changing it to a persistent device name with udev (in, for instance, "/dev/disk/by-name/raid1") won't help grub to find the right drive.
 
Old 03-21-2008, 02:42 AM   #6
aus9
Senior Member
 
Registered: Oct 2003
Location: Australia
Posts: 4,258

Rep: Reputation: Disabled
grub at mbr or at boot partition does not understand devices under /dev or udev or sysfs so forget it.

but zippy...its not clear to me...that you have realised you have 3 mbrs...each mbr should have a bootloader if what you are trying to do...is test the fail of a drive.

its easy to put a bootloader into each drive's mbr.....then change the bios boot order or remove cables to test that bios jumps to drive x mbr and then to grub and then to its booting files.
 
Old 03-22-2008, 03:19 AM   #7
Zippy1970
Member
 
Registered: Sep 2007
Posts: 72

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by aus9 View Post
grub at mbr or at boot partition does not understand each mbr should have a bootloader if what you are trying to do...is test the fail of a drive.
The third drive is a backup drive. I can put a bootloader on it if I want, but it doesn't hold anything to boot from.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 hard drives, XP on my main sata drives, 10.2 on my IDE LILO doesnt show on boot up Dachy Slackware 14 01-03-2008 07:01 AM
Installed fadora core 6 easily enough but it wont detect my other hard drives Jack Daniels Linux - Hardware 8 04-07-2007 06:27 PM
how can I detect the other Hard drives in my system? MurX Linux - Hardware 10 10-29-2005 07:55 AM
Fedora Core 3 Dual Boot, Dual Hard drives, Grub Boot Loader Denali03 Linux - Newbie 1 03-04-2005 01:44 PM
AMD 64 LIVE BOOT CD won't detect my standard IDE hard drives tk32 Linux - Hardware 3 10-31-2004 08:20 AM


All times are GMT -5. The time now is 01:33 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
Open Source Consulting | Domain Registration