We're running Hyper-V 2019 on a 2 node cluster. We have 2 VMs in the Failover Cluster which are clustered together to run a server. This service requires a shared disk. The shared disk is located in a CSV on the Hyper-V Cluster.
We recently stopped one of the VMs, but when we try to restart it we get an error
The process cannot access the file because it is being used by another process.
When we try to inspect the disk on the other VM that is still running (and hosting the drive), we get the same error.
Pretty old thread here: https://social.technet.microsoft.com/Forums/en-US/ec1c6756-7890-419a-89d0-cf7570901549/error-synthetic-scsi-controller-failed-to-power-on-the-process-cant-access-file-because-being?forum=winserverhyperv It states that the host should be rebooted and you can try to reattach VHDS to the VMs.
Alternatively, you can try building guest failover cluster using iSCSI LUNs. As an example, StarWind VSAN can be used. https://www.starwindsoftware.com/resource-library/starwind-virtual-san-for-hyper-v-2-node-hyperconverged-scenario-with-windows-server-2016/
After some further investigating, we found that the avhdx files were fine and all of our data was on them, but the vhds file was corrupted.
You can confirm this by shutting down all of the VMs that are using the shared disk, then copy and rename the .avhdx file to .vhdx, and then load it up. Warning: once we shutdown the 2nd VM, we were also unable to restart that one with the shared disk attached.
We restored the VHDS file from a SAN snapshot and were then able to load the disk back onto the VM without any further problems.
I'm not sure if there is a better way to repair a VHDS file, so the solution I've got for now is to restore the VHDS file (and only the VHDS) from a recent backup, and the avhdx files will re-attach and you'll be back in business. If that doesn't work, then I guess you're facing data loss and you should restore all of the related .avhdx files too.