All Red Hat Linux documents are copyrighted to Red Hat Inc.

2.6. GRUB Commands

GRUB allows a number of useful commands in its command line interface. Some of the commands accept options after their name; these options should be separated from the command and other options on that line by space characters.

The following is a list useful commands:

  • boot — Boots the operating system or chain loader that has been previously specified and loaded.

  • chainloader <file-name> — Loads the specified file as a chain loader. To grab the file at the first sector of the specified partition, use +1 as the file's name.

  • displaymem — Displays the current use of memory, based on information from the BIOS. This is useful to determine how much RAM a system has prior to booting it.

  • initrd <file-name> — Enables users to specify an initial RAM disk to use when booting. An initrd is necessary when the kernel needs certain modules in order to boot properly, such as when the root partition is formated with the ext3 file system.

  • install <stage-1> <install-disk> <stage-2> p <config-file> — Installs GRUB to the system MBR.

    When using the install command the user must specify the following:

    • <stage-1> — Signifies a device, partition, and file where the first boot loader image can be found, such as (hd0,0)/grub/stage1.

    • <install-disk> — Specifies the disk where the stage 1 boot loader should be installed, such as (hd0).

    • <stage-2> — Passes to the stage 1 boot loader the location of the stage 2 boot loader is located, such as (hd0,0)/grub/stage2.

    • p <config-file> — This option tells the install command to look for the menu configuration file specified by <config-file>. An example of a valid path to the configuration file is (hd0,0)/grub/grub.conf.

    WarningWarning
     

    The install command will overwrite any other information in the MBR. If executed, any information (other than GRUB information) that is used to boot other operating systems, will be lost.

  • kernel <kernel-file-name> <option-1> <option-N> — Specifies the kernel file to load from GRUB's root file system when using direct loading to boot the operating system. Options can follow the kernel command and will be passed to the kernel when it is loaded.

    For Red Hat Linux, an example kernel command looks like the following:

    kernel /vmlinuz root=/dev/hda5

    This line specifies that the vmlinuz file is loaded from GRUB's root file system, such as (hd0,0). An option is also passed to the kernel specifying that when loading the root file system for the Linux kernel, it should be on hda5, the fifth partition on the first IDE hard drive. Multiple options may be placed after this option, if needed.

  • root <device-and-partition> — Configures GRUB's root partition to be a specific device and partition, such as (hd0,0), and mounts the partition so that files can be read.

  • rootnoverify <device-and-partition> — Performs the same functions as the root command but does not mount the partition.

Commands other than these are available. Type info grub for a full list of commands.

© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.