9.6. GRUB 命​​​​​​​令​​​​​​​

GRUB 在​​​​​​​它​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​行​​​​​​​界​​​​​​​面​​​​​​​里​​​​​​​提​​​​​​​供​​​​​​​大​​​​​​​量​​​​​​​的​​​​​​​有​​​​​​​用​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​。​​​​​​​有​​​​​​​些​​​​​​​命​​​​​​​令​​​​​​​接​​​​​​​受​​​​​​​参​​​​​​​数​​​​​​​选​​​​​​​项​​​​​​​;这​​​​​​​些​​​​​​​选​​​​​​​项​​​​​​​应​​​​​​​该​​​​​​​和​​​​​​​命​​​​​​​令​​​​​​​以​​​​​​​及​​​​​​​其​​​​​​​他​​​​​​​选​​​​​​​项​​​​​​​用​​​​​​​空​​​​​​​格​​​​​​​分​​​​​​​隔​​​​​​​开​​​​​​​。​​​​​​​
下​​​​​​​面​​​​​​​是​​​​​​​一​​​​​​​个​​​​​​​有​​​​​​​用​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​的​​​​​​​列​​​​​​​表​​​​​​​:
  • boot — 引​​​​​​​导​​​​​​​操​​​​​​​作​​​​​​​系​​​​​​​统​​​​​​​或​​​​​​​者​​​​​​​最​​​​​​​后​​​​​​​被​​​​​​​装​​​​​​​载​​​​​​​的​​​​​​​ chain 装​​​​​​​载​​​​​​​程​​​​​​​序​​​​​​​。​​​​​​​
  • 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.
    下​​​​​​​面​​​​​​​是​​​​​​​ chainloader 命​​​​​​​令​​​​​​​的​​​​​​​一​​​​​​​个​​​​​​​示​​​​​​​例​​​​​​​:
    chainloader +1
  • displaymem — 根​​​​​​​据​​​​​​​ BIOS 信​​​​​​​息​​​​​​​,显​​​​​​​示​​​​​​​当​​​​​​​前​​​​​​​的​​​​​​​内​​​​​​​存​​​​​​​使​​​​​​​用​​​​​​​情​​​​​​​况​​​​​​​。​​​​​​​这​​​​​​​对​​​​​​​在​​​​​​​引​​​​​​​导​​​​​​​前​​​​​​​确​​​​​​​认​​​​​​​系​​​​​​​统​​​​​​​有​​​​​​​多​​​​​​​少​​​​​​​内​​​​​​​存​​​​​​​很​​​​​​​有​​​​​​​用​​​​​​​。​​​​​​​
  • 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.
    下​​​​​​​面​​​​​​​是​​​​​​​ 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.

    警告

    install 命​​​​​​​令​​​​​​​覆​​​​​​​盖​​​​​​​主​​​​​​​引​​​​​​​导​​​​​​​分​​​​​​​区​​​​​​​里​​​​​​​任​​​​​​​何​​​​​​​已​​​​​​​有​​​​​​​的​​​​​​​信​​​​​​​息​​​​​​​。​​​​​​​
  • 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.
    下​​​​​​​面​​​​​​​是​​​​​​​ kernel 命​​​​​​​令​​​​​​​的​​​​​​​一​​​​​​​个​​​​​​​示​​​​​​​例​​​​​​​:
    kernel /vmlinuz-2.6.8-1.523 ro root=/dev/VolGroup00/LogVol00
    前​​​​​​​面​​​​​​​例​​​​​​​子​​​​​​​里​​​​​​​的​​​​​​​选​​​​​​​项​​​​​​​指​​​​​​​定​​​​​​​了​​​​​​​ Linux 的​​​​​​​根​​​​​​​文​​​​​​​件​​​​​​​系​​​​​​​统​​​​​​​位​​​​​​​于​​​​​​​ hda5 分​​​​​​​区​​​​​​​。​​​​​​​
  • root (<device-type><device-number>,<partition>) — Configures the root partition for GRUB, such as (hd0,0), and mounts the partition.
    下​​​​​​​面​​​​​​​是​​​​​​​ 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.
你​​​​​​​还​​​​​​​可​​​​​​​以​​​​​​​找​​​​​​​到​​​​​​​其​​​​​​​他​​​​​​​一​​​​​​​些​​​​​​​可​​​​​​​用​​​​​​​的​​​​​​​命​​​​​​​令​​​​​​​;键​​​​​​​入​​​​​​​ help --all 来​​​​​​​获​​​​​​​取​​​​​​​命​​​​​​​令​​​​​​​的​​​​​​​完​​​​​​​整​​​​​​​列​​​​​​​表​​​​​​​。​​​​​​​关​​​​​​​于​​​​​​​所​​​​​​​有​​​​​​​ GRUB 命​​​​​​​令​​​​​​​的​​​​​​​描​​​​​​​述​​​​​​​,请​​​​​​​参​​​​​​​考​​​​​​​ http://www.gnu.org/software/grub/manual/ 上​​​​​​​的​​​​​​​在​​​​​​​线​​​​​​​文​​​​​​​档​​​​​​​。​​​​​​​

为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。