Fighting “Disk read error” after vmdk conversion to vhd

3 minute read

I used to have two server with VMWare Server 2.0 running. However I decided to migrate to Hyper-V because migration from Windows Server 2008 to 2008 R2 was planned anyway. The questions raises what to do with exsiting virtual machines? One of the reason to use virtual environment was to decrease the need of reinstalling OS every time we need to move it to another hardware. The solution was found in form of the vmdk2vhd utility supported by numerous success stories of such migration.

This page contains quite extensive explanation how such migration should be done. One of the most important steps is to check whether the existing machine uses IDE or SCSI controller on the boot drive. Hyper-V doesn’t boot virtual machines from virtual SCSI controller. I followed the steps described in the article and expected everything to work fine. Even better, some of my VMWare machines already had IDE controllers on a boot drive.

So far so good but when all disks have been migrated and I created quite a few new Hyper-V virtual machines, none of those started up. There were two types of errors:
<ol><li>For bigger virtual disks I got a message “Disk read error. Press Ctrl+Alt+Del to restart” on a black screen.</li><li>For the other machines I got Windows booting but crashing in a couple of seconds with the BSOD.</li></ol>After spending hours of reading excessive number of posts in different forums and blogs I managed to resolve both issues. So first I understood the reasons of these issues:
<ol><li>“Disk read error” occures after vmdk to vhd migration because MBR or partition table is not valid for the disk size. This might be a bug in vmdk2vhd, I have no idea but this issue is definitely related to the hard drive geometry.</li><li>The second issue is known as famous “inaccessible boot device” BSOD error. It only occured on those machines that used to have SCSI drives as boot devices, although I followed the instructions to avoid this problem (may be not very carefully).</li></ol>Now we get quickly to the solutions of both problems:
<ol><li>Hard drive geometry can be fixed using the teskdisk utility, which also runs on Windows. What needs to be done is simple - use Disk Manager to mount the corrupted virtual disk and run testdisk. Further steps are very well described in the following atricles:
Testdisk Step By Step
Rebuilding NTFS boot sector using Testdisk

When you are done with testdisk, don’t forget to save the new partition table and quit the utility, after that unmount your virtual disk in Disk Manager. Try starting the machine in Hyper-V and it should not give you “Disk read error” anymore.

</li><li>The IDE driver must be injected to the offline Windows machine, in the system registry. Although it sounds quite dangerous, it can be done quite easily since we again are able to access the virtual disk by mounting it on the host machine. After that it is possible to load the system registry hive to some temp node in the host machine registry. When the hive is loaded, the only thing that needs to be done is load a registry merge file that does the IDE driver injection. One of the instructions can be found here. Remember that since the registry merge file relies on the absolute registry path it is important that the hive is loaded exactly where the description says to and the temp node also has the name as per description. To be sure you can edit the registry file and check where values will be added and make adjustments if needed.
There’s also a tool called DriverInjection, but I personally never used it. It seems it does the IDE driver injection to the attached VHD without playing with registry editor.
</li></ol>When I have done both steps all my machines have started under Hyper-V!