红联Linux门户
Linux帮助

重新安装grub到mbr

发布时间:2008-12-21 23:59:19来源:红联作者:you_me
因为重新了windows系统,grub坏了,只好自己重新安装上了。

1.先下载grub4dos并安装重新启动进入grub命令模式(这个就不说了,很多有教材)

2.进入linux操作系统
root (hd0,8)
kernel (hd0,8)/boot/vmlinuz-2.6.27.7-134.fc10.i686
initrd (hd0,8)/boot/initrd-2.6.27.7-134.fc10.i686.img
boot

3.重新安装grub到MBR
[jerry@jerry ~]$ cd /boot
[jerry@jerry boot]$ su
密码:
[root@jerry boot]# grub
Probing devices to guess BIOS drives. This may take a long time.


GNU GRUB version 0.97 (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> root (hd0,8)
root (hd0,8)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 23 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+23 p (hd0,8)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded
Done.
grub> quit
[root@jerry boot]#

4.重新启动后就可以进入图形化的grub了

ps:
[root@jerry grub]# cat grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,9)不知道这里是怎么回事,变成了9,应该是8,所以要把下面的(hd0,9)全部换成8,否则找不到
# kernel /boot/vmlinuz-version ro root=/dev/sda10
# initrd /boot/initrd-version.img
#boot=/dev/sda
default=2
timeout=30
splashimage=(hd0,8)/boot/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$yN9a5rTU$ktMVYhwhJhnh9DB2pCOLT0
title Fedora (2.6.27.7-134.fc10.i686)
root (hd0,8)
kernel /boot/vmlinuz-2.6.27.7-134.fc10.i686 ro root=UUID=c7bd3111-548f-4561-961d-dcd336ecce3f rhgb quiet
initrd /boot/initrd-2.6.27.7-134.fc10.i686.img
title Fedora (2.6.27.5-117.fc10.i686)
root (hd0,8)
kernel /boot/vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=c7bd3111-548f-4561-961d-dcd336ecce3f rhgb quiet
initrd /boot/initrd-2.6.27.5-117.fc10.i686.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1

[ 本帖最后由 you_me 于 2008-12-22 01:12 编辑 ]
文章评论

共有 3 条评论

  1. wangdu2002 于 2008-12-22 17:36:06发表:

    太麻烦,装好双系?后,用dd先备份MBR,双系?引导出问题了,直接恢复最快最省事!

  2. lingxw 于 2008-12-22 09:54:39发表:

    "root (hd0,9)不知道这里是怎么回事,变成了9,应该是8"这个应该是你的windows的分区有变化,例如用过PQ等。

  3. uwoslc 于 2008-12-22 08:35:31发表:

    学习一下