MBR扇区故障修复!

一:进行分区且格式化硬盘

[root@roomc~]#mkfs -t ext4 /dev/sdb1    //格式化sdb1盘

二:模拟破坏/sda主硬盘破坏再修复!

[root@roomc~]#mkdir /a         //创建一个目录

[root@roomc~]#mount /dev/sdb1 /a     //将为故障的硬盘sdb挂载到/a目录上

[root@roomc~]#dd if=/dev/sda of=/a/xiufu bs=512 count=1     //备份sda到/a目录下取名为xiufu

[root@roomc~]#dd if=/dev/zero of=/dev/sda bs=512 count=1  //破坏sda主硬盘区

[root@roomc~]#ls /a     //查看/a目录下有没有xiufu的文件

[root@roomc~]#reboot    //重启虚拟机

三:进行故障修复!

选择troubleshooting      //故障修复

选择Rescue a CentOS system    //紧急急救

输入1(Countinue)

回车

[root@roomc~]#mkdir /b          //创建/b目录

[root@roomc~]#mount /dev/sdb1 /b    //将sdb1挂载到/b目录上

[root@roomc~]#ls /b      //查看有没有xiufu文件

[root@roomc~]#dd if=/b/xiufu of=/dev/sda bs=512 count=1    //将xiufu文件导入sda中

按ctrl+d       //完成MBR故障修复

原文地址:https://www.cnblogs.com/CMX_Shmily/p/11308230.html