Show Table of Contents
为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。
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. Aninitrd
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>
— Installs GRUB to the system MBR.p
config-file<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 theinstall
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 asroot=/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 theroot
command, but does not mount the partition.
你还可以找到其他一些可用的命令;键入
help --all
来获取命令的完整列表。关于所有 GRUB 命令的描述,请参考 http://www.gnu.org/software/grub/manual/ 上的在线文档。
为了尽快向用户提供最新的信息,本文档可能会包括由机器自动从英文原文翻译的内容。如需更多信息,请参阅此说明。