免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1196 | 回复: 0
打印 上一主题 下一主题

Grub文件丢失的修复方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-18 18:11 |只看该作者 |倒序浏览

Grub文件丢失的修复方法

1.  我系统备份的grub.conf文件配置信息如下,本次故障机有自己独立的/boot分区,以下步骤中使用的参数要视你具体的内核版本确定;
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-53.el5PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.el5PAE ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-53.el5PAE.img
title Red Hat Enterprise Linux Server with RAID1 (2.6.18-53.el5PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.el5PAE ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-raid1-2.6.18-53.el5PAE.img
title Red Hat Enterprise Linux Server (2.6.18-53.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
        initrd /initrd-2.6.18-53.el5.img

2.  某日系统被破坏,grub.conf文件损坏,不能正常启动系统,启动时进入grub提示状态:
注意:以下grub环境可以使用Tab键补全哟!
grub>
  
3.  设置grub的根设备为linux内核所在分区,因为我的/boot分区安装在第一块硬盘的第一个分区,所以设置为(hd0,0),注意这里是不区分IDC硬盘与SCSI硬盘的!
grub> root (hd0,0)

4.  设置内核参数,加载内核文件,因为我是安装的独立的/boot分区,如果/boot分区是放在/分区下面,则内核文件要指定为/boot/vmlinuz-verstion!
grub>kernel /vmlinuz-2.6.18-53.el5PAE ro root=/dev/VolGroup00/LogVol00 rhgb quiet

5.  加载内核镜像文件
grub> initrd /initrd-2.6.18-53.el5PAE.img

6.  引导系统
grub>boot

7.  进入系统后,修复或者创建新的/boot/grub/grub.conf文件,确保系统下次能够正常启动;

8.grub.conf配置文件常见参数解释:
待续…

9.如果你有光盘,还有另外一种修复方法,即进入linux rescue模式去修复grub.conf文件。
a) 光盘引导,进入linux rescue模式
boot: linux rescue
b) 根目录切换
sh-3.1#chroot /mnt/sysimage
c) 现在就可以修复或者重建grub.conf文件啦
sh-3.1# vi /boot/grub/grub.conf



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/58186/showart_1728306.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP