/boot 目录清理后,grub损坏修复

现象

处理步骤

1)将光盘挂载,ESC后进入系统拯救模式
2)确认系统的根文件是否损坏,没有损坏,系统将会挂载到 /mnt/sysimage下,需要切换至系统中运行如下命令 chroot /mnt/sysimage
3)lsblk命令查看根文件在哪个磁盘以及分区中

[)(images/image-20220320110542311.png)]

4)重新安装grub , grub-install --root-directory=/ /dev/sda

[(img-JtmEZIDr-1647746524341)(images/image-20220320111005495.png)]

5)将内核文件和initi镜像文件拷贝到/boot下面,以便grub识别
cp /boot/grub/initramfs*.img  /boot/grub/vmlinux* /boot
6)修改/boot/grub/grub.conf文件,注意Selinux=0
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_host70-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux (2.6.32-431.el6.x86_64)
	root (hd0,0)
	kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_host70-lv_root rd_NO_LUKS crashkernel=auto rd_LVM_LV=vg_host70/lv_swap rd_NO_MD rd_LVM_LV=vg_host70/lv_root LANG=zh_CN.UTF-8  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet  selinux=0
	initrd /initramfs-2.6.32-431.el6.x86_64.img
# 其中root以实际系统分区为准
7)重启系统正常。
GitHub 加速计划 / li / linux-dash
7
1
下载
A beautiful web dashboard for Linux
最近提交(Master分支:6 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐