/dev/centos/root does not exist after migrating CentOS7 from vmware to Xen

There was the same question on Reddit.

The main idea — you need to regenerate initrd.

  1. Boot into linux rescue
  2. Call dracut -f according to this article.

I've been using Starwinds V2V converter https://www.starwindsoftware.com/converter for a similar task a while ago. It supports multiple virtual machine disks formats and does internal hardware patching during conversion. There is an option to enable Rescue Mode during conversion too and it supports batch processing of multiple VMs. And it's free.

Saved me a lot of time literally. Give it a try.


I know that this answer comes in late, but I thought I would share how I got around this. I was also searching for an answer migrating CentOS7 VM's from XenServer 6.5 to Hyper-V 2016. I tried everything from Starwind, to exporting as XVA appliance and converting it using XenConvert 2.3.1, with no avail.

The solution is actually very simple, and worked the first time: Download this ISO - https://sourceforge.net/projects/boot-repair-cd/

High-level steps that I took:
1.) Export XEN VM to OVA (or convert .xva XEN appliance using any tool, like Starwind)
2.) Create NEW VM in Hyper-V and attach previously exported VHD
3.) Mount the ISO from above link in new Hyper-V VM's DVD/CDROM drive, and boot from it.
4.) Follow the prompts (NB!!! Make sure that the VM has a NIC attached that connects to an external network that hands out DHCP and internet access)
5.) Select auto repair (NB!! on the step where it reinstalls GRUB, you might need to modify the yum command, in my case I had to use - "yum erase grub*" instead of "yum erase grub*-common"
6.) Reboot and enjoy your Linux VM running on Hyper-V :)


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-*

2) 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

3) Rebuild the kernel image for that specific kernel

dracut -f

4) Select the new kernel image

ls -ltrh /boot/initramfs-*

5) 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

6) Go to the Grub config

vim /boot/grub2/grub

7) Delete the old menuentry and make sure that the new menuentry is top of all

8) Generate a GRUB configuration file

grub-mkconfig

9) Reboot

10) Done.