操作系统

Grub文件丢失的修复方法
作者 chasfer 2008年12月18日 10: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

打开APP阅读全文

Grub文件丢失的修复方法

Grub文件丢失的修复方法

长按识别二维码 进入IT168查看全文

请长按保存图片
{{data.thematic.text}}

相关文章

加载中...

分享到

请使用浏览器的分享功能
分享到微信等