Show Table of Contents
E.7. GRUB 命令
GRUB 在它的命令行界面里提供大量的有用的命令。有些命令接受参数选项;这些选项应该和命令以及其他选项用白字符分隔开。
下面是一个有用的命令的列表:
boot— 引导操作系统或者最后被安装的 chain 安装程序。chainloader </path/to/file>— 将指定的文件安装为 chain 安装程序。如果这个文件位于指定分区的第一个扇区,则使用块列表记号+1来代替文件名。下面是chainloader命令的一个示例:chainloader +1displaymem— 根据 BIOS 信息,显示当前的内存使用情况。这对在引导前确认系统有多少内存很有用。initrd </path/to/initrd>— 使用户可以指定在引导时所用的初始 RAM 磁盘文件。当内核需要某种模块才能正常引导时就需要initrd,比如当使用 ext3 或者 ext4 文件系统格式化 root 分区时。下面是initrd命令的一个示例:initrd /initrd-2.6.8-1.523.imginstall <stage-1> <install-disk> <stage-2>— 将 GRUB 安装到系统的主引导分区里。pconfig-file<stage-1>— 指定可以找到第一阶段引导装载程序映像的设备、分区和文件,如(hd0,0)/grub/stage1。<install-disk>— 指定用来安装第一阶段引导装载程序映像应该的磁盘,如(hd0)。<stage-2>— 将第二阶段引导装载程序的位置传递给第一阶段引导装载程序,如(hd0,0)/grub/stage2。p<config-file>— 这个选项告诉install命令来寻找<config-file>所指定的菜单配置文件,如(hd0,0)/grub/grub.conf。
警告
install命令覆盖主引导分区里任何已有的信息。kernel </path/to/kernel> <option-1> <option-N>... — 指定引导操作系统时要载入的内核文件。使用 root 命令所指定分区的绝对路径替换 </path/to/kernel>。使用 Linux 内核选项替换 <option-1>,比如使用root=/dev/VolGroup00/LogVol00指定该系统 root 分区所在位置。可采用以空格分开的列表为内核提供多个选项。下面是kernel命令的一个示例:kernel /vmlinuz-2.6.8-1.523 ro root=/dev/VolGroup00/LogVol00前面示例里的选项指定了 Linux 的 root 文件系统位于hda5分区。root (<device-type><device-number>,<partition>)— 分配 GRUB 的 root 分区,如(hd0,0),并挂载这个分区。下面是root命令的一个示例:root (hd0,0)rootnoverify (<device-type><device-number>,<partition>)— 分配 GRUB 的 root 分区,就象root命令一样,但不挂载此分区。
还可以找到其他一些可用的命令;键入
help --all 获取命令的完整列表。关于所有 GRUB 命令的说明,请参考 http://www.gnu.org/software/grub/manual/ 在线文件。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.