CentOS 7在grub rescue模式中修复系统

另外normal.mod的目录也有变化。特别要注意

1)首先找到centos 的boot是装在那个分区中;

1. 先使用ls命令
在 grub rescue>下输入以下命令:

ls
会罗列所有的磁盘分区信息,比方说:

引用:

(hd0,1),(hd0,5),(hd0,3),(hd0,2)
  注:我的是(hd0),(hd0,msdos3),(hd0,msdos5)等
2. 然后依次调用如下命令: X表示各个分区号码
如果/boot没有单独分区,用以下命令:

ls (hd0,X)/boot/grub2
如果/boot单独分区,则用下列命令:

ls (hd0,X)/grub2
例如:

grub rescue> ls (hd0,msdos2)/grub2

会有如下的输出:
 -grub2  grub  grub.cfg  i386-pc ...

2)

扫描二维码关注公众号,回复: 1964874 查看本文章

grub rescue> ls (hd0,msdos2)/grub2// 找到/boot分区位置
--> grub2 grub grub.cfg i386-pc ...

grub rescue> set root=hd0,msdos2// 临时重置grub位置为当前分区
grub rescue> set prefix=(hd0,msdos2)/grub2
grub rescue> insmod (hd0,msdos2)/grub2/i386-pc/normal.mod// 加载normal模块
grub rescue> normal// 调用normal模块


3)重新安装grub到sda
这时就出现了 grub引导菜单,选择进入CentOS系统

登录
login:root
passwd:*****

# cd /sbin
# grub2-install --boot-directory=/boot  /dev/sdb// 重新安装grub到sdb, 根据ls /dev/sd* 的结果,替换成你自己的硬盘

--> grub2-install completed, No Error occured.

# reboot

猜你喜欢

转载自www.linuxidc.com/Linux/2017-02/140654.htm