Centos7 虚拟机环境下断电后进入dracut模式

Vmware虚拟机环境下的Centos7,系统掉电后,无法重启,直接进入的dracut。因匆忙之中,没有来得及抓图。但记得系统提示:
Warning: /dev/centos/root does not exist
Warning: /dev/centos/swap does not exist
Warning: /dev/mapper/centos-root does not exist
然后就是提示输入journalctl查看日志。日志中主要内容也是提示以上三问题。
尝试安装盘启动恢复,提示无法找到任何linux分区。
按照https://blog.csdn.net/weixin_43905458/article/details/104059550的方法修复,在/dev目录中,找不到centos。
无奈用英文搜索,终于找到一篇文章:https://unix.stackexchange.com/questions/425045/warning-dev-centos-root-swap-centos-root-does-not-exist-after-configuring-dr
按照他的做法:

$ lvm vgscan
$ lvm vgchange -ay 
$ exit

系统引导成功!但文章说,重启后依然会失败。本人菜鸟,不明缘由。
幸好后面提供了解决方法,但我想先凑活着用,就没有敢尝试。希望高手验证。
恐网站无法访问,把解决办法转贴,共大家参考。
The reason why you’re seeing this is due of initramfs kernel image being build for the specific system it’s running on, so migrating to a new hardware will cause it to fail to boot.
Rebuilding initramfs in emergency mode(or go to the Rescue Mode ):
Then

  1. List the initramfs images you have:
 ls -ltrh /boot/initramfs-*
  1. Locate the kernel version you’re using and create a backup of it:
  cp -iv /boot/initramfs-3.10.0-1062.el7.x86_64.img /boot/initramfs-3.10.0-1062.el7.x86_64.img.back
  1. Rebuild the kernel image for that specific kernel
  dracut -f
  1. Select the new kernel image
  ls -ltrh /boot/initramfs-*
  1. Specify the new kernel version (For Example):
  dracut -f  /boot/initramfs-3.10.0-1062.el7.x86_64.img 3.10.0-1062.el7.x86_64
  1. Go to the Grub config
  vim /boot/grub2/grub
  1. Delete the old menuentry and make sure that the new menuentry is top of all
  2. Generate a GRUB configuration file
grub-mkconfig
  1. Reboot
  2. Done.
  • 2
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值