
80 Chapter 4. GRUB
Note
Remember that GRUB’s numbering system for devices starts at 0, and not 1. This 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, simply 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 first device and (hd3) specifies the fourth device.
• If a system has multiple drive devices, it is very important to know the drive order according to 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.
4.2.2. File Names
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 filename 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 filename. This
method is straightforward.
It is also possible to specify files to GRUB that do not actually appear in the filesystem, such as a
chain loader that appears in the first few blocks of a partition. To specify these files, it is required to
provide a blocklist, which tells GRUB, block by block, where the file is located in the partition. As
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.
Consider the following blocklist:
0+50,100+25,200+1
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:
(hd0,0)+1
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:
chainloader +1
Commenti su questo manuale