Reproduced
First, repair MBR:
MBR (master boot record main boot recording):
The hard disk's 0 cylinders, 0 heads, and 1 sectors are referred to as the primary boot sector. Where 446Byte is bootloader,64byte for partition table, and the remaining 2Byte is magic number.
Backup MBR:
#dd IF=/DEV/SDA Of=/root/mbr.bak count=1 bs=512
Destroy Bootloader:
#dd If=/dev/zero OF=/DEV/SDA count=1 bs=200
Here the block size as long as less than or equal to 446.
Repair method:
1. Mount disk repair with other systems.
The repair method is similar to the disc repair and is also used with the Grub2-install command.
2. Repair with the installation CD.
1. Mount the disc and select Troubleshooting on the disc Boot interface:
2. Select Enter Rescue mode:
3. Press ENTER to continue:
4. Enter the disk Mount selection mode:
The disks will be mounted to the/mnt/sysimage/
Continue mount the partition in RW mode.
Read only mounts the partition in RO mode.
Skip skips, and in the future, manually mount the disks yourself.
5. Select continue, wait a moment, prompt has been mounted complete.
6. Enter the rescue mode command line at this point:
7. Rebuild the bootloader using the Grub2-install command:
#grub2-install ROOT-DIRECTORY=/MNT/SYSIMAGE/DEV/SDA
show no errors, use sync to write to the hard drive, reboot restart the system.
8. No error after reboot, GRUB is running normally:
At this point, the MBR repair is complete.
Second, repair grub
Grub configuration file is missing:
Boot will be directly into the grub interface, displayed as Grub>
The repair steps are as follows:
Grub>insmod XFS
Grub>set root= (hd0,1)
Grub>linux16/vmlinuz-xxxxx Root=/dev/mapper/centos-root
Grub>initrd16/initramfs-.xxxxx.img
Once the repair is complete, you can enter the system and rebuild the configuration file.
Note: CentOS7 because of the use of GRUB2, configuration files and grub have a lot of changes, be sure to remember to backup grub.cfg for recovery.
CentOS 7 repair MBR and grub