Grub4dos Guide - Fundamentals


Understanding the syntax used for devices is essential - refer to previous section Device Allocation/Numbering.

When booting grub4dos a message is displayed "Booting GRLDR" closely followed by various entries. This process is displayed too quickly to read, which can cause problems identifying at which point the boot process fails in the event of any problems. If grub4dos fails to boot, quickly press the [insert] key whilst it’s loading to enter debug mode – this will display detailed step-by-step startup information and will allow you to identify at which point grub4dos is failing.

Grub4dos has a powerful command line interface, which can be scripted via a configuration file. The configuration file is automatically loaded if found - to access the command line from a boot menu press the [c] key. Entering commands from the command line is far more flexible than using configuration file entries, and will provide detailed feedback. Although the command line can be intimidating, only a handful of the 60+ commands are needed to boot the majority of operating systems. The command line is the recommended method for testing new boot options and is essential for troubleshooting problems.

File/folder paths in Grub4dos are separated with a forward slash / (not a backslash \ as used in windows based systems). Paths can be absolute using the device (e.g. (hd0,0)/MyDiskImages/msdos.img) or relative to the root directory (e.g. if root is set as device (hd0,0) then folder path /MyDiskImages/msdos.img is valid – if root is set as (hd0,0)/MyDiskImages then path /msdos.img is valid). If your file/path contains spaces (e.g. (hd0,0)/My Disk Images/msdos.img) backslash's (\) must be used (hd0,0)/My\ Disk\ Images/msdos.img.

The root device will be set as the device from which the configuration file menu.lst is loaded. If no configuration file is found during the boot process then the device from which grldr (or GRUB.exe) was loaded will be set as the root device. To change the root device or directory use the command root [PATH], where PATH = device name (e.g. root (hd0,0) ) or device and directory name (e.g. root (hd0,0)/MyDiskImages). The current root device can be designated by using closed brackets () (e.g. root ()/MyDiskImages. Once a device has been set as root, all further commands will be issued for that device, unless otherwise stated. For example, if (hd0,0) is set as the root device, the command Chainloader +1 will boot the first sector (the boot sector) of that device. Remember that paths containing spaces must contain backslash's - e.g to set (hd0,0)/My Disk Images as root, use command root (hd0,0)/My\ Disk\ Images.

To check the current root device, type root [enter]. E.g. -

grub> root
  (hd0,1): Filesystem type is ntfs, partition type 0x07

grub> _

When using the find (or find --set-root) command, all (hd) devices (and partitions) are searched before (cd), and (cd) devices are searched before (fd).

Devices must be made root in order to boot from them. There are two commands available to make a device root - root and rootnoverify. The root command will attempt to mount the specified device/partition, verifying the filesystem type. Using the rootnoverify command, the device/partition is not mounted. Using the root command is the preferred method, rootnoverify should only be used if the root command fails. See below for example output after using the root command, using rootnoverify does not provide any feedback -

grub> root (hd0,0)
  Filesystem type is fat, partition type 0x01

The Grub4dos command line has an inbuilt auto complete feature, accessed by using the [tab] key. Using the [tab] key without any commands will display a list of all available commands. Entering part of a command followed by the [tab] key will list all possible completions of the command. E.g. entering de [tab] will list completions -

grub> de
  Possible commands are: debug default

The [tab] features will be explored in more detail in the next section.