[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11. Filesystem syntax and semantics

GRUB uses a special syntax for specifying disk drives which can be accessed by BIOS. Because of BIOS limitations, GRUB cannot distinguish between IDE, ESDI, SCSI, or others. You must know yourself which BIOS device is equivalent to which OS device. Normally, that will be clear if you see the files in a device or use the command find (see section find).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.1 How to specify devices

The device syntax is like this:

 
(device[,part-num][,bsd-subpart-letter])

`[]' means the parameter is optional. device should be either `fd' or `hd' followed by a digit, like `fd0'. But you can also set device to a hexadecimal or a decimal number which is a BIOS drive number, so the following are equivalent:

 
(hd0)
(0x80)
(128)

part-num represents the partition number of device, starting from zero for primary partitions and from four for extended partitions, and bsd-subpart-letter represents the BSD disklabel subpartition, such as `a' or `e'.

A shortcut for specifying BSD subpartitions is (device,bsd-subpart-letter), in this case, GRUB searches for the first PC partition containing a BSD disklabel, then finds the subpartition bsd-subpart-letter. Here is an example:

 
(hd0,a)

The syntax `(hd0)' represents using the entire disk (or the MBR when installing GRUB), while the syntax `(hd0,0)' represents using the first partition of the disk (or the boot sector of the partition when installing GRUB).

If you enabled the network support, the special drive, `(nd)', is also available. Before using the network drive, you must initialize the network. See section Downloading OS images from a network, for more information.

If you boot GRUB from a CD-ROM, `(cd)' is available. See section Making a GRUB bootable CD-ROM, for details.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.2 How to specify files

There are two ways to specify files, by absolute file name and by block list.

An absolute file name resembles a Unix absolute file name, using `/' for the directory separator (not `\' as in DOS). One example is `(hd0,0)/boot/grub/menu.lst'. This means the file `/boot/grub/menu.lst' in the first partition of the first hard disk. If you omit the device name in an absolute file name, GRUB uses GRUB's root device implicitly. So if you set the root device to, say, `(hd1,0)' by the command root (see section root), then /boot/kernel is the same as (hd1,0)/boot/kernel.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.3 How to specify block lists

A block list is used for specifying a file that doesn't appear in the filesystem, like a chainloader. The syntax is [offset]+length[,[offset]+length]…. Here is an example:

 
0+100,200+1,300+300

This represents that GRUB should read blocks 0 through 99, block 200, and blocks 300 through 599. If you omit an offset, then GRUB assumes the offset is zero.

Like the file name syntax (see section How to specify files), if a blocklist does not contain a device name, then GRUB uses GRUB's root device. So (hd0,1)+1 is the same as +1 when the root device is `(hd0,1)'.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by root on April, 6 2008 using texi2html 1.76.