Next: CD-ROM Installation
Up: Linux Boot Loaders Compared
Previous: Making Diskette Images without
Contents
For a booting Linux on the hard disk there are basically the following
choices:
- Use an OS neutral MBR boot sector program (such as the one from
DOS) and let it boot a Linux boot loader in a primary
partition. Some such boot sector programs let the user select one of
several operating systems at boot time.
- Boot a Linux boot loader (LILO or GRUB) directly from the MBR.
- Chainload a Linux boot loader through the boot loader of another
OS (the NT Boot Manager). One could even chainload Linux from
another instance of a Linux boot loader. There could be an instance
of GRUB that is booted from the MBR and GRUB could chainload several
instances of LILO, each on its own partition.
- Boot Linux from a diskette. The diskette may contain just the
boot sector (it loads the second stage of the boot loader from the
hard disk), the entire boot loader or even the boot loader plus the
kernel.
- Boot Linux through DOS using LOADLIN.
Which option you use, depends on several factors:
- What other operating systems run on the same
machine? Chainloading Linux from the Windows NT boot loader would
make no sense on a machine without NT.
- What partitions are used on the disk? Is a RAID used? As far as
I know, LILO is the only Linux boot loader that boots from a RAID.
- What is the relative importance of each operating system?
- Perceived reliability of each boot loader.
- Personal preferences.
One factor that may complicate boot loader installation is that each
operating system has its own naming and numbering scheme for hard disks and
partitions and so does GRUB. The BIOS assigns a number to each
disk. The first disk is 0x80, the second disk is 0x81, etc. When you
install LILO, things go without problems most of the time, but there
are situations in which it may be necessary to specify the BIOS code
of a drive.
The naming convention of hard disks in GRUB can be confusing:
- The whole hard disk (if you want to install GRUB in the MBR) is
called (hd0), (hd1) etc.
- Partitions are counted from zero, so partition 1 on the first disk
is called (hd0,0). Extended partitions are counted from 4,
like they are counted from 5 in Linux.
- Disks are also counted from zero in the order that BIOS assigns
them. On most systems /dev/hda corresponds to (hd0)
(except on systems with only SCSI disks), but
what Linux disk will correspond to (hd1), depends on what you
connect to the EIDE ports. If the primary slave is a hard disk, this
disk will be /dev/hdb in Linux and (hd1) in GRUB. If the
primary slave is a CD-ROM and the secondary master is a hard disk,
the hard disk will be /dev/hdc in Linux and (hd1) in
GRUB.
Table 2 shows the disk and partition numbers on a
system with two hard disks, connected as master and slave to the
primary IDE controller. The first disk contains two primary partitions
(DOS and Linux) and two logical partitions (DOS and Linux swap). The
second disk contains one primary DOS partition.
Table 2:
Disk and partition names (first example)
Disk |
Linux |
BIOS code (LILO) |
GRUB disk name |
DOS drive |
IDE Primary Master |
/dev/hda |
0x80 |
(hd0) |
- |
Primary DOS |
/dev/hda1 |
- |
(hd0,0) |
C: |
Primary Linux |
/dev/hda2 |
- |
(hd0,1) |
- |
Extended |
/dev/hda3 |
- |
(hd0,2) |
- |
Logical DOS |
/dev/hda5 |
- |
(hd0,4) |
E: |
Linux swap |
/dev/hda6 |
- |
(hd0,5) |
- |
IDE Primary Slave |
/dev/hdb |
0x81 |
(hd1) |
- |
Primary DOS |
/dev/hdb1 |
- |
(hd1,0) |
D: |
|
Table 3 shows the disk and partition numbers on a
system with three hard disks, one on the primary IDE controller and one
on the secondary IDE controller and one SCSI.
Table 3:
Disk and partition names (second example)
Disk |
Linux |
BIOS code (LILO) |
GRUB disk name |
DOS drive |
IDE Primary Master |
/dev/hda |
0x80 |
(hd0) |
- |
Primary DOS |
/dev/hda1 |
- |
(hd0,0) |
C: |
Primary Linux |
/dev/hda2 |
- |
(hd0,1) |
- |
IDE Secondary Master |
/dev/hdc |
0x81 |
(hd1) |
- |
Primary DOS |
/dev/hdc1 |
- |
(hd1,0) |
D: |
First SCSI |
/dev/sda |
0x82 |
(hd2) |
- |
Primary DOS |
/dev/sda1 |
- |
(hd2,0) |
E: |
|
If you use FreeBSD as well, things get even more complicated. BSD
divides a normal disk partition into several sub-partitions. Linux can
only access them if support for BSD disk labels is compiled into the
kernel. Needless to say that Linux, BSD and GRUB all have different
names for these sub-partitions.
In GRUB you have to use GRUB partition names for files accessed by GRUB,
but Linux partition names for arguments on the kernel command
line. The following is a very typical kernel command line in GRUB:
kernel (hd0,1)/vmlinuz root=/dev/hda2
Finally on some (mostly older) systems, disk geometry may cause
problems. As long as everything uses LBA, no problems are expected. If
your BIOS does not support LBA, boot loaders using the BIOS have no
way to reach beyond 1024 cylinders. nuni may be a solution
in such a case, but most of the time you will need to create a small
partition near the start of the disk and boot the kernel from there.
Next: CD-ROM Installation
Up: Linux Boot Loaders Compared
Previous: Making Diskette Images without
Contents
Lennart Benschop
2003-05-29