注意:以下实验对系统有损害,请勿在主要服务器或计算机上模拟故障。
提示:以下实验内容以RH133教程习题为蓝本,在虚拟机环境中centos5.3实验。
1.主引导区损坏(丢失)
模拟故障:
root#dd if=/dev/zero of=/dev/hda bs=446 count=1;reboot
开机提示:
Operating System not found
有如没安装系统一般
解决:
从安装盘启动计算机,输入如下内容,进入救援模式:
#linux rescue
一路OK、continue,直到救援系统帮你挂载了原来的系统分区到/mnt/sysimage,如下提示:
Your system is mounted under the /mnt/sysimage directory.
When finished please exit from the shell and your system will reboot.
检查原系统的grub.conf是否配置正确。然后输入如下:
sh-3.2#chroot /mnt/sysimage
sh-3.2#grub-install /dev/hda
Installation finished . No error reported.
…
# this device map was generated by anaconda
(hda0) /dev/hda
sh-3.2#reboot
做到这儿就可以恢复引导区了。以下是红帽教程的说法,冷博客没有试验:
如果上面的grub-install 报错,按如下输入:
sh-3.2#exit
sh-3.2#grub
grub>root (hd0,0)
grub>setup (hd0)
grub>quit
2.引导文件丢失(损坏)
模拟故障:
root#cp /bin/date /bin/mount
开机提示:
经过很多的红色[FAILED]后,系统卡在Starting system logger:
解决:
从安装盘启动计算机,输入如下内容,进入救援模式:
#linux rescue
一路OK、continue,直到救援系统帮你挂载了原来的系统分区到/mnt/sysimage,如下提示:
Your system is mounted under the /mnt/sysimage directory.
When finished please exit from the shell and your system will reboot.
由于是模拟mount文件丢失(损坏),我们重新安装这个包即可。
红帽教材在这里用rpm –V util-linux命令了。这里说一下,如果安装了prelink,会产生很多“被修改”
的文件,具体为什么prelink会显示一些没有被修改的文件,我还在询问怀恋在子夜童鞋,等我弄明白会再发一篇的。
继续强制重装util-linux
sh-3.2# mount /dev/hdc /mnt
sh-3.2# cd /mnt/Centos
sh-3.2# rpm –ivh –force –root /mnt/sysimage util-linux-2.13-0.52.el5.i368.rpm
然后重启即可。




评论