2.4. GRUB Terminology
One of the most important things to understand before using GRUB is how
the program refers to devices, such as hard drives and partitions. This
information is particularly important when configuring GRUB to boot
multiple operating systems.
2.4.1. Device Names
Suppose a system has more than one hard drive. The first hard drive of
the system is called (hd0) by GRUB. The first
partition on that drive is called (hd0,0), and
the fifth partition on the second hard drive is called
(hd1,4). In general, the naming convention for
file systems when using GRUB breaks down in this way:
(<type-of-device><bios-device-number>,<partition-number>) |
The parentheses and comma are very important to the device naming
conventions. The
<type-of-device>
refers to whether a hard disk (hd) or floppy disk
(fd) is being specified.
The
<bios-device-number>
is the number of the device according to the system's BIOS, starting
with 0. The primary IDE hard drive is numbered
0, while the secondary IDE hard drive is numbered
1. The ordering is roughly equivalent to the way
the Linux kernel arranges the devices by letters, where the
a in hda relates to
0, the b in
hdb relates to 1, and so on.
![Note](./stylesheet-images/note.png) | Note |
---|
| GRUB's numbering system for devices starts with
0, not 1. Failing to make
this distinction is one of the most common mistakes made by new GRUB
users.
|
The
<partition-number>
relates to the number of a specific partition on a disk device. Like
the
<bios-device-number>,
the partition numbering starts at 0. While most
partitions are specified by numbers, if a system uses BSD partitions,
they are signified by letters, such as a or
c.
GRUB uses the following rules when naming devices and partitions:
It does not matter if system hard drives are IDE or SCSI. All
hard drives start with hd. Floppy disks start
with fd.
To specify an entire device without respect to its partitions,
leave off the comma and the partition number. This is
important when telling GRUB to configure the MBR for a particular
disk. For example, (hd0) specifies the MBR on
the first device and (hd3) specifies the MBR
on the fourth device.
If a system has multiple drive devices, it is very important
to know the drive boot order set in the BIOS. This is rather
simple to do if a system has only IDE or SCSI drives, but if there
is a mix of devices, it can become confusing.
2.4.2. File Names and Blocklists
When typing commands to GRUB involving a file, such as a menu list to
use when allowing the booting of multiple operating systems, it is
necessary to include the file immediately after specifying the device
and partition.
A sample file specification to an absolute file name is
organized as follows:
(<type-of-device><bios-device-number>,<partition-number>)/path/to/file |
Most of the time, a user will specify files by the directory path on
that partition, plus the file name.
It is also possible to specify files to GRUB that do not actually
appear in the file system, such as a chain loader that appears in the
first few blocks of a partition. To specify these files, you must
provide a blocklist, which tells GRUB, block by
block, where the file is located in the partition, since a file can be
comprised of several different sets of blocks, there is a specific way
to write blocklists. Each file's section location is described by an
offset number of blocks and then a number of blocks from that offset
point, and the sections are put together in a comma-delimited order.
The following is a sample blocklist:
This blocklist tells GRUB to use a file that starts at the first block
on the partition and uses blocks 0 through 49, 99 through 124, and
199.
Knowing how to write blocklists is useful when using GRUB to load
operating systems that use chain loading, such as Microsoft
Windows. It is possible to leave off the offset number of blocks if
starting at block 0. As an example, the chain loading file in the
first partition of the first hard drive would have the following name:
The following shows the chainloader command with a
similar blocklist designation at the GRUB command line after setting
the correct device and partition as root:
2.4.3. GRUB's Root File System
Some users are confused by the use of the term "root file system" with
GRUB. It is important to remember that GRUB's root file system has
nothing to do with the Linux root file system.
The GRUB root file system is the root partition for a particular
device. GRUB uses this information to mount the device and load files
from it.
With Red Hat Linux, once GRUB has loaded its root partition (which equates to
the /boot partition and contains the Linux
kernel), the kernel command can be executed with
the location of the kernel file as an option. Once the Linux kernel
boots, it sets the root file system Linux users are familiar with. The
original GRUB root file system and its mounts are forgotten; they only
existed to boot the kernel file.
Refer to the root and kernel
commands in Section 2.6 GRUB Commands for more information.