标签:=== bin 系统文件 emerge sys x86_64 tle lib 最小
实验目标:分别删除/boot下的initramfs-2.6.32-358.el6.x86_64.img和vmlinuz-2.6.32-358.el6.x86_64文件
然后挂载光盘,进入救援模式进行故障恢复。
实验前先查看/boot 下initramfs-2.6.32-358.el6.x86_64.img 文件属性和内容:
方法一:
===================================================================================================================
[root@rhel6 boot]#cp initramfs-2.6.32-358.el6.x86_64.img /data/ //为了查看,先把此文件拷贝到/data目录下
[root@rhel6 data]#file initramfs-2.6.32-358.el6.x86_64.img //查看文件类型
initramfs-2.6.32-358.el6.x86_64.img: gzip compressed data, from Unix, last modified: Fri Mar 7 06:01:26 2014, max compression
[root@rhel6 data]#gunzip initramfs-2.6.32-358.el6.x86_64.img //直接解压报错
gzip: initramfs-2.6.32-358.el6.x86_64.img: unknown suffix -- ignored
[root@rhel6 data]#mv initramfs-2.6.32-358.el6.x86_64.img initramfs-2.6.32-358.el6.x86_64.img.gz //文件改名为.gz后缀
[root@rhel6 data]#ls
initramfs-2.6.32-358.el6.x86_64.img.gz
[root@rhel6 data]#gzip -d initramfs-2.6.32-358.el6.x86_64.img.gz //然后解压
[root@rhel6 data]#ll /boot/initramfs-2.6.32-358.el6.x86_64.img initramfs-2.6.32-358.el6.x86_64.img //对比原文件和解压后的文件
-rw-r--r--. 1 root root 16583044 Mar 7 2014 /boot/initramfs-2.6.32-358.el6.x86_64.img //原文件
-rw-r--r-- 1 root root 46944256 Jan 15 09:39 initramfs-2.6.32-358.el6.x86_64.img //解压后
[root@rhel6 data]#file initramfs-2.6.32-358.el6.x86_64.img //再次查看文件类型为cpio格式文件
initramfs-2.6.32-358.el6.x86_64.img: ASCII cpio archive (SVR4 with no CRC)
[root@rhel6 data]#cpio -id <initramfs-2.6.32-358.el6.x86_64.img //文件解压成功
91688 blocks
[root@rhel6 data]#ls //查看发现这是一个最小化的Linux运行环境
bin emergency initqueue-finished lib pre-trigger sys var
cmdline etc initqueue-settled lib64 pre-udev sysroot
dev init initqueue-timeout mount proc tmp
dracut-004-303.el6 initqueue initramfs-2.6.32-358.el6.x86_64.img pre-pivot sbin usr
方法二:
==============================================================================================================
[root@centos6 test]#zcat initramfs-2.6.32-754.el6.x86_64.img |cpio -id //查看后,管道给cpio解压
141150 blocks
[root@centos6 test]#ls
bin emergency initqueue-finished lib pre-mount proc tmp
cmdline etc initqueue-settled lib64 pre-pivot sbin usr
dev init initqueue-timeout mount pre-trigger sys var
dracut-004-411.el6 initqueue initramfs-2.6.32-754.el6.x86_64.img netroot pre-udev sysroot
===============================================================================================================
故障救援
1、删除initramfs-2.6.32-358.el6.x86_64.img,然后再恢复
[root@rhel6 boot]#rm -rf initramfs-2.6.32-358.el6.x86_64.img //删除文件
[root@rhel6 boot]#reboot //重启,发现系统起不来
F:\ISO系统文件\rhel-server-6.4-x86_64-dvd.iso //救援之前第一步先挂载挂载光盘
连接光盘-->重置---> 鼠标点进虚拟机 --> 按一下ESC键
sh-4.1# chroot /mnt/sysimage/ //切根
sh-4.1# mkinitrd /boot/initramfs-`uname -r`.img `uname -r` //为当前正在使用的内核重新制作ramdisk文件
sh-4.1# ll /boot
total 22866
-rw-r--r--. 1 root root 104081 Jan 30 2013 config-2.6.32-358.el6.x86_64
drwxr-xr-x. 3 root root 1024 Mar 7 2014 efi
drwxr-xr-x. 2 root root 1024 Mar 7 2014 grub
-rw-r--r--. 1 root root 16647561 Jan 15 11:11 initramfs-2.6.32-358.el6.x86_64.img //删除的文件已经恢复
drwx------. 2 root root 12288 Mar 7 2014 lost+found
-rw-r--r--. 1 root root 185734 Jan 30 2013 symvers-2.6.32-358.el6.x86_64.gz
-rw-r--r--. 1 root root 2407466 Jan 30 2013 System.map-2.6.32-358.el6.x86_64
-rwxr-xr-x. 1 root root 4044560 Jan 30 2013 vmlinuz-2.6.32-358.el6.x86_64
重启电脑,成功进入系统。
2、 删除vmlinuz-2.6.32-358.el6.x86_64, 然后再恢复
[root@rhel6 boot]#reboot //重启后报错
Error 15: File not found
Press any key to continue. . .
F:\ISO系统文件\rhel-server-6.4-x86_64-dvd.iso //救援之前第一步先挂载挂载光盘
连接光盘-->重置---> 鼠标点进虚拟机 --> 按一下ESC键
sh-4.1# chroot /mnt/sysimage/ //切根
sh-4.1# mount /dev/cdrom /mnt //挂光盘
sh-4.1# cd /mnt/isolinux/
sh-4.1# cp vmlinuz /boot/vmlinuz-`uname -r` //恢复删除的Linux内核文件到/boot/
重启电脑,成功进入系统。
标签:=== bin 系统文件 emerge sys x86_64 tle lib 最小
原文地址:http://blog.51cto.com/8845692/2342829