一、修复MBR:
MBR(Master Boot Record主引导记录):
硬盘的0柱面、0磁头、1扇区称为主引导扇区。其中446Byte是bootloader,64Byte为Partition table,剩下的2Byte为magic number。
备份MBR:
#dd if=/dev/sda of=/root/mbr.bak count=1 bs=512
破坏bootloader:
#dd if=/dev/zero of=/dev/sda count=1 bs=200
这里边block size只要小于等于446即可。
修复方式:
1、借助其他系统挂载磁盘修复。
修复方式同光盘修复类似,也是使用grub2-install命令。
2、借助安装光盘修复。
1).装入光盘,在光盘引导界面选择troubleshooting:
Image may be NSFW.Clik here to view.

2).选择进入救援模式:
Image may be NSFW.Clik here to view.

3).按回车键继续:
Image may be NSFW.Clik here to view.

4).进入磁盘挂载选择模式:
磁盘将会被挂载至/mnt/sysimage/下
continue 以rw方式挂载分区。
read only 以ro方式挂载分区。
skip 跳过,将来自己手工挂载磁盘。
Image may be NSFW.Clik here to view.

5.选择continue,稍等片刻,提示已经挂载完成。
Image may be NSFW.Clik here to view.

Image may be NSFW.
Clik here to view.

6.此时进入救援模式的命令行:
Image may be NSFW.Clik here to view.

7.使用grub2-install命令重建bootloader:
#grub2-install root-directory=/mnt/sysimage /dev/sda
Image may be NSFW.Clik here to view.

显示无错误,使用sync写入硬盘,reboot重启系统。
8.重启后无错误,grub正常运行:
Image may be NSFW.Clik here to view.

至此,MBR修复完成。
上一页12 下一页 阅读全文