A few days ago, the Windows system failed and needed to be reinstalled, since Windows 7 and CentOS 7 were installed on the hard disk before Windows system rewritten MBR caused CentOS to boot, because there is data in CentOS, Unwilling to reload, he decided to fix the MBR and grub himself.
1. System environment
Windowsos:windows 7
Linuxos:centos 7
2, the required tools:
2.1, CentOS 7 boot CD (because my computer does not have an optical drive, so directly to the CentOS ISO file written to the USB stick. )
2.2, need to repair the computer
3. Repair process:
3.1, modify the BIOS, choose to boot from the USB stick.
3.2. When entering the CentOS boot interface, select "Troubleshooting"
3.3. Then select rescue Mode
3.4, wait for a period of time, enter the hard drive Mount option, select "Continue" to mount all partitions of the hard disk as read-write mode
3.5, then all the way to choose "OK"
3.6. Enter Rescue mode command line
3.7, now officially began to repair
#chroot/mnt/sysimage (Switch the working directory to the/mnt/sysimage directory)
#grub2-INSTALL/DEV/SDX (Install GRUB2 to the hard disk MBR, where SDX represents your startup hard disk, the first block is SDA, the second is SDB, and so on)
The repair succeeds when the screen displays the following content
#exit (cut the working directory back to/root)
#sync (write to Hard disk)
To this MBR has been repaired, the following continue to repair GRUB2
#chroot/mnt/sysimage
#mount/dev/sda8/mnt (Mount the boot partition of CentOS in the/MNT directory)
#grub2-mkconfig-o/boot/grub2/grub.conf (fix grub2 configuration file, note that if the boot is partitioned separately, the path is:/grub2/grub.conf)
Grub will then automatically search for the operating system installed on the hard disk and display it, and the GRUB2 repair is complete.
#exit
#reboot (Reboot the system, then the familiar Grub selection menu comes out ....) )
To this MBR and GRUB2 all repair completed.
PS: Personal Essays, if there is a mistake, please correct me ...
Install Windows and Linux dual system after MBR and GRUB2 repair