系统CentOS 6 的/boot 恢复随笔
2021-09-13 本文已影响0人
木头_95b3
背景
系统管理员误删了 /boot 目录下的文件,操作系统为centos6.9 ,现在要想办法做恢复操作。使用虚拟机还原当时的恢复操作
准备工具
系统镜像:CentOS-6.9-x86_64-bin-DVD1.iso (最好保持与被恢复系统版本相同)
操作步骤
使用 rm -rf /boot/ 删除boot目录下的所有文件。重启操作系统

出现如下报错

挂载准备好的镜像

进入救援模式










安装内核需要加 --force因为本身系统已经安装了内核,现在强制重装,这一步主要是生成/boot目录下的vmlinuz内核、initramfs系统启动加载驱动的伪根镜像文件。
grub-install 是生成引导grub文件内容



现在内核文件与grub文件都有了,现在就编辑grub.conf 来调用内核文件,启动系统
编辑grub菜单(/boot/grub/grub.conf ):
default=0 : 默认启动第一个系统
timeout=5 : 如果 5 秒内用户没有按下任意键,那么系统会进入 default 字段定义的系统
kernel /vmlinuz-2.6.32-696.el6.x86_64 指定内核文件
root=/dev/mapper/VolGroup-lv_root 执行根目录
initrd /initramfs-2.6.32-696.el6.x86_64.img

重启:

成功进入到操作系统:
