LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-18-2007, 08:45 AM   #1
jdege
LQ Newbie
 
Registered: Aug 2006
Posts: 15

Rep: Reputation: 0
How does Grub keep track of disks?


AIUI, grub consists of two parts. Stage 1 is placed in the MBR of a disk or partition, stage 2 is somewhere on disk.

It's the BIOS that determines which MBR is loaded, from there on, it is Grub.

Grub's stage 1 has to store, somewhere in the MBR, where stage 2 is. Stage 2 has to store, somewhere on disk, where the kernel, the initrd, and the root partition is.

The question is, how are these stored?

Does stage 1 record the disk by ID, or by device number?

Suppose I have a slave IDE disk I'm configuring to be my primary boot drive. It's currently /dev/hdb, and stage2 is in /dev/hdb1. If I write stage1 to the MBR, telling it to find stage 2 on /dev/hdb1, will it be able to do so, when I swap the drive jumpers, and that drive is now /dev/hda?
 
Old 12-18-2007, 08:57 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Off hand, I don't know the answer how grub part1 access the rest of grub. However, once grub is loaded, it has support to access the drives and partitions by name. It loads in the /boot/grub/menu.lst file to bring up your grub menu. This text file contains the location of the kernel and initrd file as well as other options. If it can't find it, you can enter the grub shell and locate them manually. It even has autocompetion which can help to browse the different partitions to locate where the kernel and initrd files are. From there you can enter the "b" command to boot.

If the bios and grub have different ideas on which is the first drive, you can modify the /boot/grub/device.map file to map /dev/sd* to (hd*) styled entries. This allows you to edit the menu.lst file, run grub-install and have the grub bootstrap loader installed to the correct drive.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub on 2 hard disks ninadb Linux - General 1 03-28-2005 06:57 AM
Install GRUB On Both Disks in RAID 1 Pair? doctorcisco Linux - Software 2 02-21-2005 02:43 AM
grub/lilo problem with 2 scsi-disks finky Linux - Software 5 12-03-2004 06:39 AM
Grub And Raid 1 Root Disks Super_Z Linux - General 0 06-14-2004 02:22 AM
2 disks, 2 OS, but GRUB hangs richardg Linux - Newbie 4 08-15-2003 08:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration