Linux Failure simulation
1, MBR damage
1.1. With host: (slightly)
1.2. Use emergency rescue mode: System installation CD
Boot:linux Rescue
/mnt/sysimage
To create a device file manually: Mknod
[Email protected] ~]# fdisk-l
disk/dev/sda:113.8 GB, 113816633344 bytes
255 heads, Sectors/track, 13837 cylinders
...
[[email protected] ~]# dd if=/dev/sda of=/root/mbr.backup count=1 bs=512 # backup before test
1+0 Records in
1+0 Records out
Bytes (+ B) copied, 0.00372704 seconds, 137 kb/s
[Email protected] ~]# Ll/root/mbr.backup
-rw-r--r--1 root root 9 08:27/root/mbr.backup
[[email protected] ~]# dd if=/dev/zero of=/dev/sda count=1 bs=300 # clear HDD Front 300b
1+0 Records in
1+0 Records out
Bytes (B) copied, 6.3003e-05 seconds, 4.8 MB/s
[Email protected] ~]#
The workaround is as follows : Start the installation CD
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8B/53/wKioL1hKBYKzJ9wpAAFWwDxD9js543.png-wh_500x0-wm_3 -wmp_4-s_4000021429.png "title=" Rescue1.png "alt=" Wkiol1hkbykzj9wpaafwwdxd9js543.png-wh_50 "/>
CD-ROM startup input: Linux rescue
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/57/wKiom1hKBsbQ1NOWAACbi7dKGy8935.png-wh_500x0-wm_3 -wmp_4-s_4120602886.png "title=" Rescue4.png "alt=" Wkiom1hkbsbq1nowaacbi7dkgy8935.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/57/wKiom1hKBkHjddomAAAoa-49iYc349.png-wh_500x0-wm_3 -wmp_4-s_1366923683.png "style=" Float:none; "title=" Rescue2.png "alt=" wkiom1hkbkhjddomaaaoa-49iyc349.png-wh_50 "/ >
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8B/53/wKioL1hKBkLjopn-AABZqaEiBcU138.png-wh_500x0-wm_3 -wmp_4-s_3196217713.png "style=" Float:none; "title=" Rescue3.png "alt=" wkiol1hkbkljopn-aabzqaeibcu138.png-wh_50 "/ >
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8B/57/wKiom1hKB5zSRugZAABheVNEWXA810.png-wh_500x0-wm_3 -wmp_4-s_3412590808.png "title=" Rescue5.png "alt=" Wkiom1hkb5zsrugzaabhevnewxa810.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8B/57/wKiom1hKB8azfbXSAACvtGVpwzQ516.png-wh_500x0-wm_3 -wmp_4-s_1857902455.png "title=" Rescue6.png "alt=" Wkiom1hkb8azfbxsaacvtgvpwzq516.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8B/53/wKioL1hKCBjAO00aAAD_eqvoMYE352.png-wh_500x0-wm_3 -wmp_4-s_319694715.png "title=" Rescue7.png "alt=" Wkiol1hkcbjao00aaad_eqvomye352.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8B/57/wKiom1hKCFiwnG6rAAE8hrzuNFM440.png-wh_500x0-wm_3 -wmp_4-s_591621595.png "title=" Rescue8.png "alt=" Wkiom1hkcfiwng6raae8hrzunfm440.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8B/57/wKiom1hKCJWwhA5yAACw8mWb-R8685.png-wh_500x0-wm_3 -wmp_4-s_3466593865.png "title=" Rescue9.png "alt=" Wkiom1hkcjwwha5yaacw8mwb-r8685.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8B/57/wKiom1hKCPzRYfYiAAA-mgolzqE446.png-wh_500x0-wm_3 -wmp_4-s_887578204.png "title=" Rescue10.png "alt=" Wkiom1hkcpzryfyiaaa-mgolzqe446.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8B/54/wKioL1hKCl2CEvclAAFCdKXAtrs046.png-wh_500x0-wm_3 -wmp_4-s_922997104.png "title=" Rescue11.png "alt=" Wkiol1hkcl2cevclaafcdkxatrs046.png-wh_50 "/>
2. Grub corruption or file loss
[[email protected] ~]# mv/boot/grub/grub.conf/root/ # Erase Grub File
[[Email protected] ~]# Sync
Post-boot appears as follows:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8B/57/wKiom1hKC7-DOQWNAABiz_-_HBQ369.png-wh_500x0-wm_3 -wmp_4-s_2866316329.png "title=" Rescue-grub1.png "alt=" Wkiom1hkc7-doqwnaabiz_-_hbq369.png-wh_50 "/>
The solution is as follows:
grub> Root (hd0,0)
Grub> Kernel/vmlinuz-ro Root=/dev/sd7 # The root path is/DEV/SD7 when installing the system
Grub> initrd/initrd-
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/8B/58/wKiom1hKIxaS6khdAAF3Vsd-FNc554.png-wh_500x0-wm_3 -wmp_4-s_1328253941.png "title=" Rescue-grub2.png "alt=" Wkiom1hkixas6khdaaf3vsd-fnc554.png-wh_50 "/>
3. Kernel Panic: Kernel panic
3.1. Default level is set to 0 or 6: Enter single user mode, modify Inittab file
3.2. No boot files in/ETC/RC.D/RC3.D: Enter single user mode, create new related files
3.3. SendMail: The preparation file timestamp check failed:
3.3.1. Turn off the service in single-user mode;
3.3.2. Time stamp in single-user mode repair;
3.3.3. Press " I " key to enter interactive mode at startup, manually specify whether all services are started;
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/8B/59/wKiom1hKJe-RYgQIAAFDaY4k-JI073.png-wh_500x0-wm_3 -wmp_4-s_4146923367.png "title=" Rescue-service1.png "alt=" Wkiom1hkje-rygqiaafday4k-ji073.png-wh_50 "/>
4. File syntax error or logic error in/etc/rc.local: Change file in single-user mode
5. Path variable error: do not exit the interface first
Backup files under/etc, (version control program: Svn,git developer)
Export Path=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
6. mingetty file lost: Go to Single user mode, network or CD-ROM mode reinstall
Bash lost:/bin/bash Rename simulation lost
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8B/56/wKioL1hKMrWDri0FAAE-fSiEcAo681.png-wh_500x0-wm_3 -wmp_4-s_3104947210.png "style=" Float:none; "title=" Rescue-service2.png "alt=" Wkiol1hkmrwdri0faae-fsiecao681.png-wh_50 "/>
Can not be shut down in the boot failure;
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8B/5A/wKiom1hKMrrw9lcbAAGHhxz7zEo298.png-wh_500x0-wm_3 -wmp_4-s_1885905644.png "style=" Float:none; "title=" Rescue-service3.png "alt=" Wkiom1hkmrrw9lcbaaghhxz7zeo298.png-wh_50 "/>
Workaround:
CD-ROM boot into emergency mode and reinstall bash using the installation files on the CD
6.1. No Network: Mount CD
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/8B/57/wKioL1hKRLXhSA7zAAImda18q6g811.png-wh_500x0-wm_3 -wmp_4-s_207115851.png "title=" Rescue-service4.png "alt=" Wkiol1hkrlxhsa7zaaimda18q6g811.png-wh_50 "/>
6.2 A network: Copy bash installation files over the network
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8B/5A/wKiom1hKRzrzUub4AADrZHnBm9g883.png-wh_500x0-wm_3 -wmp_4-s_2605123990.png "title=" Rescue-service5.png "alt=" Wkiom1hkrzrzuub4aadrzhnbm9g883.png-wh_50 "/>
---end---
Linux Failure simulation