How to fix the issue with the Hyper-V VM restore: ‘The file or directory is corrupted and unreadable’
Some of you may have already faced a situation where one of your servers was down, and you needed to recover it as soon as possible. In a difficult situation like this, having a backup image of your server somewhere on external storage -- or, even better, in the cloud -- is paramount for fast recovery. This article explains how to restore an image-based backup from cloud storage. It also explains how to fix a common error that you may encounter (with the message “The file or directory is corrupted or unreadable”) during recovery.
One of the fastest ways to restore a server that is not working is to use its backup image to create a virtual machine. All you need is to install the agent on any other server with a virtual platform, then create a virtual disk from your backup. Once it is done you can start a new virtual machine from this virtual disk.
Suggestions and Resolutions
Since there are many different disk partition configurations, your configuration may differ from the one described below. Our task in this article is to describe how to solve one of the recovery problems that may appear. For the purposes of this article, we will consider the standard division of a physical disk into a boot partition and a system partition, since in most cases this is enough to start a new virtual machine. All additional partitions with data can be restored using separate restore plans and attached to the virtual machine after the main recovery process.
Please note that the steps below describe the use case when you are restoring an image-based backup of a Windows-based computer with a GUID Partition Table (GPT) as a virtual disk in VHDX format. Any other configuration requires additional testing and might produce a different outcome.
Restore an image-based backup to a virtual disk in VHDX format
- Make a restore plan of the image-based backup with two partitions included from the cloud or local storage to a virtual disk in VHDX format. One of the approaches to do this is from the Backup storage tab in the backup agent console. Right-click to open the drop-down menu with the Restore option.
- Once the restore plan is complete and a VHDX file is created, you can spin up a new Hyper-V VM using the VHDX file you created.
In most cases, at this stage, you start this virtual machine and everything works just fine. Then you continue to recover data disks and attach them to this virtual machine.
However, sometimes you encounter an error message that reads, "The file or directory is corrupted and unreadable."
Fortunately, with a few extra steps, you can resolve this issue and start the virtual machine successfully. Following is what you need to do.
- Repeat the restore process once again. This time, you need to create two different restore plans and make two different virtual disks from two different partitions: The first uses the VHDX file based on the boot partition, and the second uses the system partition.
- Once the two VHDX files created, you can configure a virtual machine to use both of them. Make sure that one you are going to boot from the VHDX file you made from the boot partition (and not the other one).
- With the configuration complete, you can start your virtual machine.