centos6
The first phase of the boot damage
446 bytes of damage mbr
Back up
[root@centos6 ~]# dd if=/dev/sda of=/root/mbr bs=1 count=446
damage
[root@centos6 ~]# dd if=/dev/zero of=/dev/sda bs=1 count=446
There can be used to back up the case of a backup recovery is not turned off
[root@centos6 ~]# dd if=/root/mbr of=/dev/sda bs=1 count=446
No backup is not turned off, you can directly use the command grub-install recovery
[root@centos6 ~]# grub-install /dev/sda
After the shutdown, did not mount the boot disc will be displayed
Mount the CD into rescue mode select the third
Follow the prompts to finally open the shell
First switching path root, then using the grub-install command
chroot /mnt/sysimage
grub-install /dev/sda
If you do not want to switch the root, the following steps
cp /mnt/sysimage/sbin/grub /sbin
grub-install --root-directory=/mnt/sysimage /dev/sda
Finally you can look at the first 446 bytes of content
hexdump -C -n 446 -v /dev/sda
No problem you can restart the exit confirmation
Stage 1.5 boot destruction
damage
dd if=/dev/zero of=/dev/sda bs=1 count=10240 skip=512 seek=512
Phenomenon: only cursor blinks
FIX: CD-ROM to boot into rescue mode
chroot /mnt/sysimage
grub-install /dev/sda
sync
Exit to restart
The second phase of the boot damage
Reservations /boot/grub/grub.conf, delete / boot / grub / all other files
Phenomenon: Error 15
The same repair method Stage 1 1.5 Stage
grub.conf file is missing
Phenomenon: boot directly into the grub
repair:
root (hd0 then the Tab key out,
/ Boot partition using ordinary partitions that are likely to be 0x83 / boot partition, I have here is only one, 8e as lvm, that is, choose hd0,0
Choosing the right content at this time the Tab key is prompted after entering the kernel / vm or completion of, if there are multiple kernel are listed, I am here only a kernel, so a direct complement the
Wrong / boot partition will be given later kernel Tab again, a plurality of partitions to select another partition, the partition until the election
After completion kernel root partition further need to manually specify the location, where I is lvm logical partition is set automatically when the system is installed, if not known in advance particularly hard to check the correct path, reference may be other machines of the same installation.
After entering kernel /vmlinuz-2.6.32-754.el6.x86_64 root = / dev / mapper / vg_centos6-lv_root carriage, kernel and root path according to their actual conditions
Then initrd / init behind the supplemental content Tab key Enter
After you enter a carriage return after will be able to boot into the system
After entering the system you need to manually write /boot/grub/grub.conf configuration files, refer to the following
Since the completion kernel after kernel also need to fill the root partition, if an ordinary partition can be exhaustive / dev / sda all partitions, use lvm more difficult, you can use the CD directly boot into rescue mode, in rescue mode can see the regional situation, directly edit the grub.conf file in rescue mode
You can write a few lines below the normal start
default=0
timeout=5
title CentOS 6
root (hd0,0)
kernel /vmlinuz-2.6.32-754.el6.x86_64 ro root=/dev/mapper/vg_centos6-lv_root
initrd /initramfs-2.6.32-754.el6.x86_64.img
initrd-2.6.32-754.el6.x86_64.img file is missing
Phenomenon, no reaction after the end of the countdown, this phenomenon should be there is only a start menu will appear
Another phenomenon is black, only the cursor blink
Repair Method 1
CD-ROM, just as rescue mode
First switching root path
chroot /mnt/sysimage
Then regenerate the initramfs file
mkinitrd /boot/initramfs-$(uname -r).img $(uname -r)
Wait a minute to regenerate the file after running
Exit to restart
Repair Method 2
CD-ROM boot into rescue mode
Mount the CD to the / tmp directory
Then reinstall the kernel package
rpm -ivh /tmp/Packages/kernel-2.6.32-754.el6.x86_64.rpm --root=/mnt/sysimage --replacepkgs
Wait for the installation to complete restart to quit
If the handover can not specify the root path through --root = / mnt / sysimage
/ Boot / vmlinuz file is missing
phenomenon:
repair:
1. CD-ROM boot into rescue mode
Switching Root: chroot / mnt / sysimage
Mount the CD: mount / dev / sr0 / mnt
Copy files to CD vmlinuz / boot / directory: cp / mnt / isolinux / vmlinuz / boot / vmlinuz - $ (uname -r)
Exit Restart
2. reinstall the kernel in the CD-ROM
/ Etc / fstab and / boot / grub / files are missing
Phenomenon: enter the grub
FIX: CD-ROM boot into rescue mode
A prompt could not find the root
blkid command not found root can see related, but see type lvm2_member
Use vgdisplay and lvdispaly can see the relevant information
First enable vg
vgchange -is
Now blkid can see several other partition information
Create a directory / test, the original root partition mounted on / test, then write / test / etc / fstab file based on the partition information manually, just write to mount the root of which one is enough, other information may mount write again after you've fixed systems
After re-writing reboot the system into rescue mode, where you can find the root file system and mount / mnt / sysimage
Switching root
chroot / mnt / sysinage
mount the / boot partition
grub-install / dev / sda command to repair
manually create the /boot/grub/grub.conf file
After exiting the restart