converting vhdx to qcow2 error

sahostking

Renowned Member
Hi

Trying to convert vhdx to qcow2. I'm trying a 400GB vhdx from hyperv. I use the following line for example:

qemu-img convert -O qcow2 LIN02-Home.vhdx vm-109-disk-2.qcow2

When doing so it goes through but then sometime during the process it returns this error:

qemu-img: error while reading sector 112918502: Input/output error

52G -rw-r--r-- 1 root root 52G Jan 6 12:44 vm-109-disk-2.qcow2

The above obviously is wrong as the vhdx is using 300GB of 400GB for website files.

Now I know I got this right before as a few months ago I transferred a few VMs also VHDx files but 20GB ones over and they worked with no issues whatsoever.

Just can't remember if I made any special changes to do so.
Also when I copy the VHDX back to hyperv server and mount it all works well so quite confused.

Anyone come across the above error and know how to fix it?

btw version is:
qemu-img version 2.4.1pve-qemu-kvm_2.4-17, Copyright (c) 2004-2008 Fabrice Bellard
 
Hi,
you have to convert the vhdx to vhd and then convert to qcow2.
qemu-img can't convert vhdx.
 
ok works with no errors.

However as this is now /dev/sda as was a linux Hyper V vhd. IT does not boot.

It gives me Boot Failed: Noo bootable Disk error.

So attached the vhd again to hyperv to see if the vhd is faulty but it wors fine there.
So converted it again to qcow2, raw and even tried vmdk.

All the same error. All the other VHD's on the same VM are fine. But the /dev/sda one when running fdisk via rescuecd gives me no partition table?

No /dev/sda1 or /dev/sda2 etc.
Am I missing a step ?
 
Just still does not make sense though. It had 7 VMs on it. and this VM itself has 4 VHDs. All other VMs transfer fine with same setup. This one giving me issue with the boot vhd which is cloudlinux. So still do not understand how sysprep helps in this regard if others worked