grub的安装

以root 登录,输入”grub”命令以后,就会看到如下的画面:

GRUB version 0.5.96.1 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ]

grub>

以上看到的就是 grub 提示符,我们要在这个提示符下面安装GRUB。

grub> install (hd0,1)/boot/grub/stage1 d (hd0) (hd0,1)/boot/grub/stage2 p (hd0,1)/boot/grub/menu.lst

GRUB 分为两个主要的步骤, stage1 和 stage2。Stage1 是一段嵌入MBR 的迷你代码。Stage2 是主要部分,在 stage1 把控制权传递给它后,就由它来接管所有事情。

install 后面指定stage1 的位置,我们不仅说明了其分区
位置:(hd0,1),因为 GRUB 能读取文件系统,所以还说
明了分区上目录位置:/boot/grub/stage1,d 参数表示 stage1 将寻找 stage2 所在的磁盘。接着就是 GRUB 的安装位置:(hd0) ,这里就是指安装在MBR。后面的参数指定 stage2 的位置:(hd0,1),和 stage1 的定义一样。p 参数指定 menu.lst 文件的位置。

对于 /boot 作为单独的分区的例子,需要采用下面的命令行:

grub> install (hd0,1)/grub/stage1 d (hd0) (hd0,1)/boot/grub/stage2 p (hd0,1)/grub/menu.lst

以上例子假设 /boot 位于 (hd0,1) (也就是hda2),而 / 位于(hd0,2) (也就是 hda3) ,我们不能用 ‘(hd0,2)/boot/grub/stage1′ ,因为GRUB 不知道 (hd0,1) 是 /boot ,所以必须首先指向挂接为 /boot 的分区,然后把目录指向那里。

Discussion Area - Leave a Comment




*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word