Updating the Linux boot image before migrating from VMWare to Hyper-V
-
I am migrating a client from two VMWare 5.5 servers to a single Hyper-V Server 2012 R2 using 5Nine's V2V converter.
All of the Windows systems migrated with no issues. Obviously I needed to uninstall VMWare tools and install the updated Hyper-V tools after the migration.
I ran into problems when I migrated the first Linux VM. It was a basic CentOS 7 VM running Nginx. It would not boot after the migration. Instead it booted to a dracut prompt.
A little time on Google led me to needing to install some Hyper-V modules into the boot image prior to the migration or from a recovery DVD after the migration. Since I had backups, I just decided to migrate again.
All of the instructions I found revolved around CentOS 5 and 6.
# CentOS 5 regenerate initrd for Hyper-V mkinitrd -f -v --with=hid-base-hv --with=hid-hyperv --with=hv_utils --with=hv_vmbus --with=hv_storvsc --with=hv_netvsc /boot/initrd-$(uname -r).img $(uname -r) # CentOS 6 regenerate initramfs for Hyper-V mkinitrd -f -v --with=hid-base-hv --with=hid-hyperv --with=hv_utils --with=hv_vmbus --with=hv_storvsc --with=hv_netvsc /boot/initramfs-$(uname -r).img $(uname -r)
When I tried this on CentOS 7 it complained that
hid-base-hv
was not found. SO I simply removed it and ran the command again.# CentOS 7 regenerate initramfs for Hyper-V mkinitrd -f -v --with=hid-hyperv --with=hv_utils --with=hv_vmbus --with=hv_storvsc --with=hv_netvsc /boot/initramfs-$(uname -r).img $(uname -r)
After this, I shutdown the VM on VMWare and ran 5Nine a second time. This time the VM booted perfectly in Hyper-V after the conversion.
-
You might add the How-To tag.
Nice work.
-
I have migrated a number of CentOS 7 VM's successfully now.
As soon as the backup completes, I will be running the script on a CentOS 5 box (Elastix 2.4)
-
The Elastix 2.4 VM migrated well. I had to remove the network adapter afterwards and put in a legacy adapter from Hyper-V but then it came right up.
-
Hello. Was pointed to this thread by someone in the Spiceworks Community. I'm migrating VMware VMs to Hyper-V. Some are CentOS machines. In order to create an initramfs file with the hyper-v modules, do I need to install something for hyper-v in the VM as it sits on VMware? Thanks for any input.
-
@rg2016 said in Updating the Linux boot image before migrating from VMWare to Hyper-V:
Hello. Was pointed to this thread by someone in the Spiceworks Community. I'm migrating VMware VMs to Hyper-V. Some are CentOS machines. In order to create an initramfs file with the hyper-v modules, do I need to install something for hyper-v in the VM as it sits on VMware? Thanks for any input.
No, this should be a core part of CentOS.
-
@JaredBusch said in Updating the Linux boot image before migrating from VMWare to Hyper-V:
@rg2016 said in Updating the Linux boot image before migrating from VMWare to Hyper-V:
Hello. Was pointed to this thread by someone in the Spiceworks Community. I'm migrating VMware VMs to Hyper-V. Some are CentOS machines. In order to create an initramfs file with the hyper-v modules, do I need to install something for hyper-v in the VM as it sits on VMware? Thanks for any input.
No, this should be a core part of CentOS.
Thank you very much!
-
Thank you for posting this. It was a great help to me. I found that I could use 5Nine to transfer the VM to Hyper-V, boot into rescue mode when bringing up the VM on Hyper-V and run the mkinitrd command. The VM then boots normally.
-
@rg2016 said in Updating the Linux boot image before migrating from VMWare to Hyper-V:
Thank you for posting this. It was a great help to me. I found that I could use 5Nine to transfer the VM to Hyper-V, boot into rescue mode when bringing up the VM on Hyper-V and run the mkinitrd command. The VM then boots normally.
That is what I posted above. You had to do it either before or after the migration. I had current backups to roll back to in case of a problem, so I simply did it prior to the migration. Either way works to rebuild it though.
-
I've successfully migrated several Ubuntu VMs from ESXi and XenServer to HyperV 2012 by exporting the VM and then using Starwind's VHD converter. I've not had to run any scripts on the Linux VMs before shutting them down and exporting.
-
SUPER old post, I know, but I am running into this issue as well.
I am migrating one VM (CentOS 7, FreePBX) from a KVM VM to a Hyper-V server. I used the conversion tool "qemu-img" which worked great for another Windows workload I converted.
I did not run the command as you noted in the post before the conversion. so now I am stuck with a boot error:
Warning /dev/s7_freepbx/root does not exist Warning /dev/s7_freepbx/swap does not exist
I booted into rescue mode with a recovery DVD/Image. I pressed 1 to continue. It told me "Your system has been mounted under /mnt/sysimage. I pressed return to drop into a shell.
I tried the command below.mkinitrd -f -v --with=hid-hyperv --with=hv_utils --with=hv_vmbus --with=hv_storvsc --with=hv_netvsc /boot/initramfs-$(uname -r).img $(uname -r)
I got the error:
dracut: Cannot find /usr/lib/dracut/dracut-init.sh
So I typed "chroot /mnt/sysimage" and tried the command again.
and got the error below
-
After I posted this, I ran the same command again, and it appeared to complete successfully. Then I rebooted and got the same exact error message.
Warning /dev/s7_freepbx/root does not exist Warning /dev/s7_freepbx/swap does not exist
-
In case anyone else runs across this same issue, I got this resolved with a simple command:
dracut --regenerate-all -f && grub2-mkconfig -o /boot/grub2/grub.cfg
After doing this, everything booted up properly.
I then installed hyperv-daemons, rebooted, and everything works great.