I. repair MBR: MBR (master boot record of MasterBootRecord): the hard disk has 0 cylinder, 0 Head, and 1 sector as the main boot sector. Among them, 446Byte is bootloader, 64Byte is Partitiontable, and the remaining 2Byte is m 1. repair MBR:
MBR (Master Boot Record ):
The hard disk has 0 cylinders, 0 heads, and 1-sector names as the primary boot sector. Among them, 446Byte is bootloader, 64Byte is 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
The block size must be less than or equal to 446.
Solution:
1. use other systems to mount disks for restoration.
The repair method is similar to the CD fix, and the grub2-install command is also used.
2. use the installation disc for restoration.
1. mount the disc and select troubleshooting on the boot page:
2. select to enter the rescue mode:
3. press enter to continue:
4. select the disk mounting mode:
The disk will be mounted to/mnt/sysimage /.
-
Continue mounts partitions in rw mode.
Read only mounts partitions in ro mode.
Skip the skip and manually attach the disk.
5. select continue. wait a moment and the system prompts that the mounting is complete.
6. enter the command line in rescue mode:
7. use the grub2-install command to recreate bootloader:
# Grub2-install root-directory =/mnt/sysimage/dev/sda
No error is displayed. use sync to write data to the hard disk and reboot to restart the system.
8. there is no error after restart, and grub runs properly:
So far, MBR repair is complete.
II. repair grub
Grub configuration file loss:
After the instance is started, the grub page is displayed as grub>:
The repair procedure is as follows:
Grub> insmod xfs
Grub> set root = (hd0, 1)
Grub> linux16/vmlinuz-xxxxx root =/dev/mapper/centos-root
Grub> initrd16/initramfs-. xxxxx. img
After the repair is completed, you can enter the system and recreate the configuration file.
Note: Because CentOS7 uses grub2, the configuration file has many changes with grub. Be sure to back up grub. cfg for recovery.
This article is from the "small private blog" blog, please be sure to keep this source http://ggvylf.blog.51cto.com/784661/1618345