Use a shared vhdx as shared drive

Solution 1:

Before I answer your question, I want to add a little side note. It is possible to add a shared VHDX to two independent virtual machines and both can access the VHDX at the same time. However, it is not supported. TomTom already explained why.

So if you tried to do that out of curiosity and you found it working: don't use it!

To answer your question: If you need a highly available shared storage, create a Guest Failover Cluster and add a File Server cluster role that uses the shared VHDX as storage. Using little words, this is how you would do it:

  1. Install a Windows Server 2012 R2 on each HV node. Those are the guest nodes.
  2. Create a new VHDX and add it to both guest cluster nodes as a shared VHDX.
  3. Install and configure the Failover Cluster feature on each guest node.
  4. In the guest cluster, add the new drive to the cluster storage.
  5. Add the File Server cluster role to your guest failover cluster.
  6. Configure your network shares.

More literature on that topic:

  • Virtual Hard Disk Sharing Overview
  • SMB Transparent Failover – making file shares continuously available

Solution 2:

Well, you can do it with the VHDX - but that will not work unless the partitions on the disc support sharing. Which is VERY limited in windows, and for a good reason. So, if you plan to put files there and "just share the disc" it will corrupt because both machines, not aware of file sharing, will cache reads and write to the disc file system overwriting each others changes.

Shared discs are only supported for clustered use: Clustered Quorum or Clustered Shared Storage. Of with a cluster aware file system (that windows does not have out of the box).