修复GRUB引导故障!

故障原因:MBR中的GRUB引导程序遭到破坏,grub.conf文件丢失,引导配置有误

故障现象:系统引导停滞,显示“grub>”提示符

解决思路:若无MBR备份,进入急救模式,重新安装grub程序

 示例:

第一步模拟Grub损坏:

[root@www~]#dd if=/dev/zero of=/dev/sda bs=200 count=1    //将MRB扇区破环

[root@www~]#reboot                                                               //重启虚拟机

第二步:进入bios将CD光盘设置第一启动项(利用+号移动CD,fn+f10保存)

第三步:进入急救模式

//选择Troubleshooting

 

//选择Bescue a CentOs system

第四步:输入命令修复Grub

输入1(continue)

sh-4.2#chroot /mnt/sysimage                             //改变磁盘根目录到/mnt/sysimage/

bash-4.2#grub2-install /dev/sda                                  //安装grub到sda下

bash-4.2#grub2-mkconfig >/boot/grub2/grub.cfg           //  重定向文件到boot下                        

bash-4.2#sync                                  //同步数据

bash-4.2#exit                                   //退出

sh-4.2#reboot                                  //重启

第五步:开机完成修复(选择Boot from local drive本地硬盘启动)

原文地址:https://www.cnblogs.com/CMX_Shmily/p/11316056.html