900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > linux 7 恢复系统 CentOS 7在grub rescue模式中修复系统

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

时间:2021-06-16 22:43:26

相关推荐

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

安装完CentOS 7后 修改硬盘分区后,系统重启后,没法正常启动,进入grub rescue模式;centos

网上大多数centos grub rescue的资料应该是Centos 7以前的,其中提到的命令不少使用的目录是grub,而在7中,这里应该替换成grub2;spa

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

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

1. 先使用ls命令

在 grub rescue>下输入如下命令:blog

ls

会罗列全部的磁盘分区信息,比方说:class

引用:import

(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)/grub2im

会有以下的输出:

-grub2 grub grub.cfg i386-pc ...

2)

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。