系统相关
首页 > 系统相关> > Linux系统grub损坏修复案例

Linux系统grub损坏修复案例

作者:互联网

Linux系统grub损坏修复案例

/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)重启系统正常。

标签:rd,grub,系统,boot,损坏,Linux,root
来源: https://blog.csdn.net/yolo2016/article/details/123609829