First, the MBR and partition tables are backed up, and the backed up MBR files are stored in an FTP or USB flash drive, backup kernel file installation package
[[email protected] ~] #dd if=/dev/sda of=/root/mbr bs=512 count=1[[email Protected] ~]# cd /boot[[email protected] boot]# lsconfig-3.10.0-123.el7.x86_64 symvers-3.10.0-123.el7.x86_64.gzgrub2 system.map-3.10.0-123.el7.x86_64initramfs-0-rescue-9e0bb12a92ad483499d77d78010474c1.img vmlinuz-0-rescue-9e0bb12a92ad483499d77d78010474c1initramfs-3.10.0-123.el7.x86_64.img vmlinuz-3.10.0-123.el7.x86_64[[email protected] boot]# rpm -qf vmlinuz-3.10.0-123.el7.x86_64 kernel-3.10.0-123.el7.x86_64
In the installation CD,
KERNEL-3.10.0-123.EL7.X86_64.RPM Package for Backup
Second, the simulation system MBR and Boot folder is missing, this step does not operate when the boot is repaired
[[email protected] boot]# dd If=/dev/zero OF=/DEV/SDA bs=512 count=1[[email protected] boot]# rm-rf/boot/*
Third, repair start : Mount the CD or boot from PXE, into the rescue mode
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/6F/wKioL1XQV02Q6g-4AAC6hZUNK2w664.jpg "style=" float: none; "title=" 1.PNG "alt=" Wkiol1xqv02q6g-4aac6hzunk2w664.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/71/72/wKiom1XQVUSyDJuqAAE8EuYiBso455.jpg "style=" float: none; "title=" 2.PNG "alt=" Wkiom1xqvusydjuqaae8euyibso455.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/6F/wKioL1XQV02xK-fhAAHiHlTODxA795.jpg "style=" float: none; "title=" 3.PNG "alt=" Wkiol1xqv02xk-fhaahihltodxa795.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/72/wKiom1XQVUTCG5QcAAChxXxC4JI225.jpg "style=" float: none; "title=" 4.PNG "alt=" Wkiom1xqvutcg5qcaachxxxc4ji225.jpg "/>
Configure an IP address for the local network adapter, and then download the MBR on the FTP to the local
#ifconfig eno33554960 192.168.0.102 netmask 255.255.255.0#ftp 192.168.0.99#get mbr#bye#dd if=mbr OF=/DEV/SDA
This restores the MBR and the partition table
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/72/wKiom1XQVsDQ_KtOAALNjCMVmeg549.jpg "title=" 5.PNG " alt= "Wkiom1xqvsdq_ktoaalnjcmvmeg549.jpg"/>
Press Exit,exit, restart the computer, re-enter the rescue mode, the system has been able to identify the partition table, the root mount to the/mnt/sysimage
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/71/73/wKiom1XQWBuwEvXfAAEDbLJJwcI430.jpg "title=" 7.PNG " alt= "Wkiom1xqwbuwevxfaaedbljjwci430.jpg"/>
Re-switch the root back/, then reinstall Grub, reinstall the kernel file
Sh-4.2#chroot/mnt/sysimagebash-4.2#grub2-install/dev/sdabash-4.2#ifconfig eno33554960 192.168.0.102 netmask 255.255.255.0bash-4.2#ftp 192.168.0.99bash-4.2#get KERNEL-3.10.0-123.EL7.X86_64.RPMBASH-4.2#RPM-IVH--force kernel-3.10.0-123.el7.x86_64.rpm
Restart the computer, proceed to rescue mode, regenerate the grub.cfg configuration file
Bash-4.2#grub2-mkconfig >/boot/grub2/grub.cfgbash-4.2#syncbash-4.2#exitexit
The system will automatically restart two times, after the boot is complete, the system repair is complete, can log on the system normally
If only the grub.cfg file is missing, you can manually enter the start command at the Grub command prompt and use Grub2-mkconfig >/boot/grub2/after the boot is complete Grub.cfg to repair the Grub.cfg file, when starting to partition the hard disk, root=/dev/sda1 if the logical volume, the root of the volume group name and not the same, here/dev/mapper/rhel-root for example
Grub> set root= ' hd0,msdos1 ' grub> linux16/vmlinuz-3.10.0-123.el7.x86_64 root=/dev/mapper/rhel-root rogrub> initrd16/initramfs-3.10.0-123.el7.x86_64.imggrub> Boot
Use Grub2-mkconfig to repair grub configuration files after booting to the desktop
#grub2-mkconfig >/boot/grub2/grub.cfg
The system boots properly after rebooting
RHEL7 Boot boot Process repair