centos|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

1
2
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私房菜,说的很详细
【centos|centos 6/centos 7开机mbr/grub出现故障的修复方法】转载于:https://blog.51cto.com/10201808/2150630

    推荐阅读