centos 6/centos 7开机mbr/grub出现故障的修复方法

CentOS 6:
当grub出现故障,但未重启,可以如下恢复
方法一:
[root@localhost ~]# dd if=/dev/sda of=/root/mbr.bak count=1 bs=512 #备份
[root@localhost ~]#dd if=/dev/zero of=/dev/sda count=1 bs=200 #破坏mbr扇区
[root@localhost ~]#sync
[root@localhost ~]# grub-install --root-directory=/ /dev/sda #恢复mbr
[root@localhost ~]# reboot
方法二:
[root@localhost ~]# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> reboot

如果已经重启了系统,此时插入光盘(救援盘)在开机界面选择Rescue install或按(ESC->linux rescue #== Rescue install重启后的救援模式,然后依次选择
contunue
shell bash shell
chroot /mnt/sysimage
grub-install --root-direcoryt=/ /dev/sda
exit #退出shell
reboot #停掉光驱,重启正常进入系统

CentOS 7 mbr修复
[root@localhost ~]# dd if=/dev/sda of=/root/mbr.bak count=1 bs=512 #备份
[root@localhost ~]# dd if=/dev/zero of=/dev/sda count=1 bs=200 #破坏mbr扇区
[root@localhost ~]# sync
[root@localhost ~]# reboot
#插入光盘,依次选择如下
Troubleshooting
Rescue a CentOS system
<Enter>
1 <Continue>
2 <shell>
sh-4.2# grub2-install --root-directory=/mnt/sysimage /dev/sda

CentOS 7 grub修复(在修复mbr的基础上增加一个步骤)
sh-4.2# grub2-mkconfig -o /boot/grub2/grub.cfg
sh-4.2# exit
sh-4.2# reboot #成功启动系统,更多关于此项可参阅鸟哥的linux私房菜,说的很详细

转载于:https://blog.51cto.com/10201808/2150630

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值