Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

9.6. Comandos do GRUB

O GRUB permite que uma série de comandos úteis sejam usados na sua linha de comando. Alguns dos comandos aceitam opções após o seu nome, as quais devem ser separadas do comando em si e de outras opções na mesma linha por caracteres de espaço.
Veja a seguir uma lista de comandos úteis:
  • boot — Inicializa o sistema operacional ou o último carregador em cadeia a ter sido carregado.
  • chainloader </path/to/file> — Loads the specified file as a chain loader. If the file is located on the first sector of the specified partition, use the blocklist notation, +1, instead of the file name.
    Veja a seguir um exemplo do comando chainloader:
    chainloader +1
  • displaymem — Exibe a utilização de memória atual, baseado na informação do BIOS. Útil para determinar a quantidade de memória disponível em um sistema antes de inicializá-lo.
  • initrd </path/to/initrd> — 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 formatted with the ext3 file system.
    Veja a seguir um exemplo do comando initrd:
    initrd /initrd-2.6.8-1.523.img
  • install <stage-1> <install-disk> <stage-2> p config-file — Installs GRUB to the system MBR.
    • <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 the stage 2 boot loader location to the stage 1 boot loader, 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>, such as (hd0,0)/grub/grub.conf.

    Atenção

    O comando install sobrescreve quaisque informações já contidas no MBR.
  • kernel </path/to/kernel> <option-1> <option-N> ... — Specifies the kernel file to load when booting the operating system. Replace </path/to/kernel> with an absolute path from the partition specified by the root command. Replace <option-1> with options for the Linux kernel, such as root=/dev/VolGroup00/LogVol00 to specify the device on which the root partition for the system is located. Multiple options can be passed to the kernel in a space separated list.
    Veja a seguir um exemplo do comando kernel:
    kernel /vmlinuz-2.6.8-1.523 ro root=/dev/VolGroup00/LogVol00
    A opção no exemplo anterior especifica que o sistema de arquivos raiz para o Linux está localizado na partição hda5.
  • root (<device-type><device-number>,<partition>) — Configures the root partition for GRUB, such as (hd0,0), and mounts the partition.
    Veja a seguir um exemplo do comando root:
    root (hd0,0)
  • rootnoverify (<device-type><device-number>,<partition>) — Configures the root partition for GRUB, just like the root command, but does not mount the partition.
Outros comandos também estão disponíveis. Digite help --all para uma lista completa de comandos. Para uma descrição de todos os comandos do GRUB, consulte a documentação disponível online em http://www.gnu.org/software/grub/manual/.