I have a Windows Cluster made up of two nodes connected via SAS to a storage array. I have two virtual machines configured with their hard disks (vhdx) on the shared storage. They are up and running correctly. Now I need to build a "shared volume" between these two vm, that is a disk with files and folders in, that can be accessed from both servers, like an smb share. I understood that it was possible creating a vhdx file on the shared storage and then attaching it to both vm flagging "enable virtual hard disk sharing" but I think I misunderstood something. Can you tell me if this is realizable or not, end eventually what's the best practice to reach my goal? I basically need a storage accessible simultaneously from two virtual machines, possibly without setup a separate file server to expose smb shares.
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:
- Install a Windows Server 2012 R2 on each HV node. Those are the guest nodes.
- Create a new VHDX and add it to both guest cluster nodes as a shared VHDX.
- Install and configure the Failover Cluster feature on each guest node.
- In the guest cluster, add the new drive to the cluster storage.
- Add the File Server cluster role to your guest failover cluster.
- Configure your network shares.
More literature on that topic:
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).