2019- 06- 16 11:19 Script House Centos
Some friends don’t know how CentOs7 repairs MBR and GRUB; today I will share CentOs7’s method to repair MBR and GRUB; interested friends, let’s take a look.
**1. Repair MBR: **
MBR
( Master Boot Record):
The 0 cylinder, 0 head, and 1 sector of the hard disk are called the master boot sector. Among them, 446Byte is the bootloader, 64Byte is the Partition table, and the remaining 2Byte is the magic number.
Backup MBR:
Destroy the bootloader:
Here, as long as the block size is less than or equal to 446.
**Repair method: **
1、 Use other systems to mount disk repair.
The repair method is similar to the CD-ROM repair, but also uses the grub2-install command.
2、 Repair with the help of the installation CD.
1). Load the CD, select troubleshooting on the CD boot interface:
2). Choose to enter rescue mode:
3). Press Enter to continue:
4). Enter the disk mount selection mode:
The disk will be mounted under /mnt/sysimage/
continue to mount the partition in rw mode.
read only mounts the partition in ro mode.
skip Skip, mount the disk manually in the future.
No error is displayed, use sync to write to the hard disk, reboot to restart the system.
At this point, the MBR repair is complete.
2. Repair grub
**Grub configuration file is missing: **
After booting, it will directly enter the grub interface, which is 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
After the repair is complete, you can enter the system and rebuild the configuration file.
Note: Because CentOS7 uses grub2, the configuration file has many changes with grub, so remember to back up grub.cfg for recovery.
( adsbygoogle = window.adsbygoogle || []).push({});
Recommended Posts