linux下/boot目录丢失的恢复
1,查看分区,boot分区是独立的,进入boot后删掉所有的文件

2,删除boot启动之后的启动画面,因为vmlinuz-*和initrd-*都在/boot目录下,所有是不可能手动指定内核的路径点

3,用第一张光盘引导,进入rescue模式

4,提示当前的系统被挂载在/mnt/sysimage下边,系统会去查找/ect/fstab文件,如果有就会有下边的提示,如果没有会告诉你没有任何分区

5,使用chroot 来改变当前的操作路径,不然是对内存中的系统操作

6,建立一个目录/cdrom,将光驱挂载,查找kernel相关的包

如何知道/boot下边的内核文件是由哪个包生成的呢?在别的机器上用rpm -qf file来查询

7,强制安装内核包,要加参数--force强制安装,不然提示包已经安装

8,查看/boot目录,多文件了

9,但是删掉了/boot目录内容的时候也把grub的stage2删掉了,下边就需要安装grub了,如果是安装在mbr中用,路径用/dev/sda,如果是装在分区的superblock中,需要用/dev/sdax,x代表具体的分区。现在就发现多了grub目录了

10,但是grub目录中并没有grub.conf文件,也就是说系统启动还是无法找到正确的引导文件,

就需要编辑配置文件,添加如图所示行


