0

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.

maurice
  • 51
  • 2
  • 6

2 Answers2

2

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:

Daniel
  • 6,780
  • 5
  • 31
  • 60
  • I think this is what I was looking for. One more question: I see that using this method I can create network shares and assign permissions to the share, when I access the share from a vm can I set ACL as I usually do on my fileserver? Suppose to have 50 users and the share contains "personal" folders mapped on each user. – maurice Jan 26 '16 at 12:50
  • ["You can also use the net share command to create a shared folder in a clustered file server, **but you must run the command from the cluster node that currently owns the corresponding disk.**"](https://technet.microsoft.com/en-us/library/dd197480%28v=ws.10%29.aspx) -- Never tried, but it sounds like you can. You could also try to use PowerShell cmdlets using Parameter `-ComputerName FILECLUSTER` – Daniel Jan 26 '16 at 12:55
  • Ok. Final question: the share created is available both to cluster hosts and guest vm? – maurice Jan 26 '16 at 13:00
  • The share is hosted by the guest cluster. The guest cluster has a virtual IP address assigned to it. Hence, the share will be reachable by everyone in that network. I also edited my answer and added some more literature to it. Make sure you read it, it explains a lot. – Daniel Jan 26 '16 at 13:04
  • Thank you for your adds. Since in the guest cluster, apart from the fileserver role, there will be some virtual machines (in the same network) I think the share will be available to the VMs. – maurice Jan 26 '16 at 13:12
1

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).

TomTom
  • 50,857
  • 7
  • 52
  • 134
  • Ok, so what do you suggest to have a "shared" disk between the two vm? – maurice Jan 26 '16 at 11:17
  • Nothing. Bad idea for normal use. Or buy a clustered file system. – TomTom Jan 26 '16 at 11:22
  • But... what about creating a shared disk in the "Disks" section of the failover cluster manager? I saw some environment - for example - where they have sql database on these kind of disks and then two different sql nodes maps the same disks... – maurice Jan 26 '16 at 11:27
  • @maurice No. Or: yes. In this case this is a shared ressource and only ONE NODE EVER will use it at the same time. Cluster failover takes care of this. – TomTom Jan 26 '16 at 12:10