Centos开机故障进入dracut模式

Centos开机故障进入dracut模式

由于系统配置参数错误,开机进入dracut模式,并进行以下报错

Warning: /dev/centos/root does not exist
Warning: /dev/centos/home does not exist
Warning: /dev/centos/swap does not exist
Warning: /dev/mapper/centos-root does not exist

寻找不到相关LVM分区(vg名称因某操作修改成了newcentos,配置文件相关内核启动参数只需要订正即可)

查看LVM情况(显示未激活VG,这样导致无法挂载根目录进行操作)

# blkid
/dev/sda2: UUID="9UurP7-hKWa-zUEb-FBQL-9Cdk-17Si-PBwxGZ" TYPE="LVM2_member" 
/dev/sda1: UUID="85775bb6-ab14-4b77-ad24-4e92ab5e353d" TYPE="xfs" 
# lvm lvs
  LV   VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home newcentos -wi------- 66.99g                                                    
  root newcentos -wi------- 50.00g                                                    
  swap newcentos -wi-------  2.00g    

启用VG

# lvm vgchange -ay
# blkid
/dev/sda2: UUID="9UurP7-hKWa-zUEb-FBQL-9Cdk-17Si-PBwxGZ" TYPE="LVM2_member" 
/dev/sda1: UUID="85775bb6-ab14-4b77-ad24-4e92ab5e353d" TYPE="xfs" 
# lvm lvs
  LV   VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home newcentos -wi-a----- 66.99g                                                    
  root newcentos -wi-a----- 50.00g                                                    
  swap newcentos -wi-a-----  2.00g   

挂载root,修改grub配置文件

# mkdir tmp1
# mount /dev/newcentos/root tmp1
# vim tmp1/etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=newcentos/root  rd.lvm.lv=newcentos/swap rhgb quiet"

修改开机挂载文件

# vim tmp1/etc/fstab 
/dev/mapper/newcentos-root /                       xfs     defaults        0 0
UUID=85775bb6-ab14-4b77-ad24-4e92ab5e353d /boot                   xfs     defaults        0 0
/dev/mapper/newcentos-home /home                   xfs     defaults        0 0
/dev/mapper/newcentos-swap swap                    swap    defaults        0 0

挂载boot,修改grub2配置文件

# mkdir tmp2
# mount /dev/sda1 
# vi tmp2/grub2/grub.cfg
linux16 /vmlinuz-3.10.0-1160.el7.x86_64 root=/dev/mapper/newcentos-root ro crashkernel=auto rd.lvm.lv=newcentos/root rd.lvm.lv=newcentos/swap  rhgb quiet LANG=en_US.UTF-8
linux16 /vmlinuz-0-rescue-f3abd6c361dd1a45a0d5ad02a85370e1 root=/dev/mapper/newcentos-root ro crashkernel=auto rd.lvm.lv=newcentos/root rd.lvm.lv=newcentos/swap rhgb quiet

重启即可正常启动

你可能感兴趣的:(Debug,Hacks,centos,linux,运维)