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

List the initramfs images you have:
ls -ltrh /boot/initramfs-*
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
Rebuild the kernel image for that specific kernel
dracut -f
Select the new kernel image
ls -ltrh /boot/initramfs-*
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
Go to the Grub config
vim /boot/grub2/grub
Delete the old menuentry and make sure that the new menuentry is top of all
Generate a GRUB configuration file
grub-mkconfig
Reboot
Done.
————————————————
版权声明:本文为CSDN博主「Bibiolatrist」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Bibiolatrist/article/details/107241614