In some cases, it may be necessary to share the same virtual disk (VMDK or RMD) between 2 (or more) virtual machines (VMs) running on VMWare ESXi hosts. This configuration is most commonly used in clustering scenarios. You can share the VMDK file located on the shared storage or on a local datastore on the ESXi host. If you want to use the shared disk on different ESXi hosts, you can use only the shared VMFS (datastore) or SAN/iSCSI/vSAN storage. A shared virtual disk is a VMDK file that two or more virtual machines can read and write simultaneously.
VMware Multi-Writer Mode for Shared VMDK
VMware VMFS is a clustered file system shared between multiple ESXi hosts. By default, VMFS, NFS datastores, and vSAN do not allow multiple virtual machines to access the same .vmdk file simultaneously (locks are used). This prevents VMs from accessing other virtual machines’ disks and avoids data corruption or loss.
However, VMware technology allows sharing of VMFS-backed disks between several VMs. This feature is called Multi-writer VMDK, allowing the use of using the same disk between multiple VMs. The Multi-Writer option ensures that a guest host clustering application (such as Oracle RAC or Microsoft MSCS) doesn’t cause data loss when accessing from two or more virtual machines (cluster nodes).
Hint. Multi-writer is also used for VMWare Fault Tolerance when primary and standby virtual machines access a shared vmdk file simultaneously.
Virtual disks, which must be available simultaneously in several VMWare virtual machines, use the Multi-writer technology (available starting from VMware ESXI 5.5 and newer). This shared disk operation mode is usually used in cluster solutions for Oracle RAC and Microsoft MSCS (Microsoft Cluster Service) clusters.
Multi-writer disk restrictions
The main restrictions of shared VMWare disks in Multi-Writer mode:
- You won’t be able to perform the online migration of running VMs with shared disk to another host (vMotion), or datastore (Storage vMotion). You can migrate between ESXi hosts only powered off virtual.
Hint. vMotion is only supported for Oracle RAC cluster with up to 8 ESXi hosts;
- If you try to write data to such a vmdk from the guest operating system (for example, creating a folder), then this data (folder) will be visible only on the host that created it. Those, the Multi-Writer VMDK technology is needed just for clustering, and it’s impossible to use it as a shared disk with automatic file synchronization;
- You cannot expand such a VMDK disk online (if you try to increase the size of the vmdk, you get the error: The disk extend operation failed: The virtual disk requires a feature not supported by this program. Hot-extend is currently supported only for VMFS flat virtual disks without snapshots opened in persistent mode);
- You can’t suspend a VM with a shared disk;
- Snapshot creation and Changed Block Tracking technology are not supported (only for independent-persistent disk starting from vSphere 5.1 update 2);
- Virtual disks in multi-writer mode must not be connected to the virtual NVMe controller.
Sharing a VMDK Disk Between Two Virtual Machines on ESXi Hosts
Suppose the shared external storage (connected to each ESXi host using iSCSI or Fiber Channel SAN) has already been presented to all VMWare ESXi 6.5 hosts. These hosts running the two VMs (node1 and node2) you want to add a shared virtual disk. On both virtual machines, you need to add a new SCSI controller.
In the vSphere Client inventory select the first virtual machine (Node 1), and select Actions > Edit Settings.
To add a new virtual device select Add New Device > SCSI controller in the dropdown list, and press the Add button.
Select LSI Logic SAS as a type of SCSI controller. Be sure to create a new SCSI controller, don’t use a default SCSI 0 controller.
Note. Check how to configure autostart of VM on VMware ESXi.
Now you need to choose the SCSI Bus sharing mode:
- Virtual — if you want to share a virtual disk between VMs on the same ESXi host;
- Physical — used when you need to share VMDK file between VMs on different ESXi hosts (if you have multiple ESXi hosts in VMWare vSphere cluster then you must use this bus sharing mode).
Hint. None mode is used only for non-clustering Multi-writer drives.
Press OK. Next, you need to add a new virtual disk on the first VM (Add New Device > Hard Disk > Add) with the following disk settings:
- VM Storage Policy: optional;
- Location: you need to select a shared datastore name that will store the vmdk file;
- Disk Provisioning: select Thick provision eager zeroed (shared virtual disk cannot be zeroed thick or thin provisioned. You can use other disk provisioned types if your shared vmdk file is located on the vSAN 6.7 Patch 01 datastore).
Note. You can convert thick to thin in VMWare ESXi;
- Sharing: Multi-writer;
- Virtual Device Node: select the SCSI controller created earlier;
- Disk mode: Independent – Persistent – in this mode, you can’t create snapshots for a virtual drive you want to share.
Hint. If you enabled VMWare Fault Tolerance protection for a virtual machine, the multi-write VMDK mode is enabled automatically for virtual disks.
In the same way, you need to add a new SCSI controller to another virtual machine (Node 2). Then you need to add a new disk (Existing Hard Disk) in the settings of the second virtual machine.
Select the VMFS Datastore, which stores the shared vmdk file that you created earlier for the first VM. Select the name of the first virtual machine, and in the middle pane select the desired vmdk file.
Also, you need to select the Sharing mode — Multi-Writer for this disk.
If you want to use more than one shared disk on VMware, remember that each doesn’t require an additional SCSI controller. You can connect up to 16 different drives for a single SCSI controller.
Make sure you use the same SCSI device address for a shared vmdk disk on both virtual machines. Therefore, if you added SCSI Controller 1 when creating a SCSI controller, you should select it. For example, if you have a new address SCSI(1:0) on VM (node1) for a new disk (this means the first disk on the second SCSI controller), you should use the same address SCSI(1:0) for the shared disk on the second VM (node2). It is important!
Note. In ESXi versions, before ESXi vSphere 6.0 update 1, the MultiWriter mode for vmdk is also supported, but you cannot enable it from the vSphere Web Client interface. You can add a multi-writer flag by shutting down the VM and manually editing the vmx file of the virtual machine, adding the following line at the end of the file:SCSI1:0.sharing = “multi-writer”
You can also add this parameter in the VM properties: Options > General > Configuration Parameters: Scsi1:0:sharing “multi-writer”.
After changing the virtual machine’s settings, connect to the console of the guest OS virtual machine. In this case, the VMs running Windows Server, so you can remotely connect to them using RDP (how to enable RDP remotely). Run the Computer Management console (compmgmt.msc), and expand Storage > Disk Management section. Right-click and select Rescan Disk.
The system detects the new disk and offers to initialize it. Select the desired partition table (GPT or MBR), create a new partition, and format it. Similar operations must be performed on the second VM. After these settings, both VMs are using a shared disk. Now you can proceed to set up a cluster solution based on Oracle RAC and Microsoft Cluster Services (MSCS).
Note. Keep in mind that using multi-writer VMDKs for non-clustered scenarios is not supported. If the shared VMDK disk is online on both ESXi hosts, you won’t see changes made to the disk by one virtual machine in the other virtual machine. This will happen until you bring the disk offline and then bring it online.
When trying to migrate a VM with a connected vmdk disk in MultiWriter mode, an error will appear:
Virtual machine is configured to use a device that prevents the operation: Device ‘SCSI controller X’ is an SCSI controller engaged in bus-sharing.
To resolve this issue turn off the VM, and perform cold vMotion.
In a similar way, you can provide simultaneous access from different VMs to the same raw LUN via Raw Device Mapping (RDM) mode. In this case, the RDM disk is being added to node1 as usual, and when adding a disk to node2 instead of selecting the LUN number, you need to select the mapping VMDK file for the RDM disk on the VMFS Datastore.
Note. Check our VMware distributed switch Ultimate guide.
Starting from vSphere 6.7 Update 1 you can share a single virtual disk in multi-writer mode on more than 8 hosts simultaneously. This behavior is supported for VMFS5/VMFS6 datastores as well after you enabled the /VMFS3/GBLAllowMW config option.
Configuring Shared Disk in VMware Workstation
You can also create a vmdk disk and share it between two running virtual machines on VMware Workstation. You can use a shared vmdk disk in two or more VMs to test cluster scenarios. This mode only works in the Pro version and is available starting with VMware Workstation 12.
You can create a shared disk in VMware Workstation from the command prompt using the vmware-vdiskmanager.exe utility. Open cmd.exe as an administrator and run the commands:
mkdir SharedVMDK cd SharedVMDK
Create a new 5 GB VMDK disk:
"C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -c -s 5GB -a lsilogic -t 4 shareddisk01.vmdk
Creating disk ‘shareddisk01.vmdk’
Create: 100% done.
Virtual disk creation successful.
Now you need to add the vmdk file (disk) you created to the first virtual machine. Open the settings of the virtual machine to which you want to add the shared disk: Add > Hard Disk > SCSI disk type > Use an existing virtual disk > select file shareddisk01.vmdk.
In the Converting existing virtual disk to new format window, select Keep Existing Format.
Save your VM settings.
Referer. Learn how to use RVTools.
Now select the Hard Disk you added and click the Advanced button. Select the mode Independent > Persistent for the SCSI controller.
Save the VM settings disk. Do not turn on the virtual machine immediately. You need to manually edit the virtual machine configuration file (vmx). Run the command:
Add the following lines to the VMX configuration file:
scsi0.sharedBus = "virtual" disk.locking = "false"
Save the file.
Now add the shared VMDK file to the second virtual machine in the same way. Edit the VMX file of the second VM and add the same lines.
Start both VMs. When they run, a warning message will appear:
Clustering is not supported for VMware Workstation. This setting will be ignored.
Ignore this message. Now you can set up Windows Server Failover Cluster (WSFC) or Oracle RAC in your virtual machines running on VMware Workstation. The shared VMDK disk will be available in both VMs.
Note. Check our article on how to convert VMDK to VHDX (VMWare to Hyper-V).
VMware Multi-writer disk FAQs
1. What is a shared virtual disk in VMware ESXi? A shared virtual disk is a VMDK file that two or more virtual machines (VMs) can read and write at the same time. This configuration is commonly used in clustering scenarios.
2. What is VMware Multi-Writer Mode? VMware Multi-Writer Mode is a feature that allows sharing of VMFS-backed disks between several VMs. It ensures that a guest host clustering application doesn’t cause data loss when accessing from two or more virtual machines.
3. What are the main restrictions of shared VMWare disks in Multi-Writer mode? There are several restrictions to consider. For instance, you cannot perform online migration of running VMs with shared disks to another host (vMotion), or datastore (Storage vMotion). You also cannot expand such a VMDK disk online or suspend a VM with a shared disk. Other restrictions include limitations on snapshot creation and the use of Changed Block Tracking technology.
4. How can I share a VMDK Disk between two Virtual Machines on ESXi Hosts? To share a VMDK Disk between two Virtual Machines on ESXi Hosts, you need to add a new SCSI controller to both virtual machines and then add a new disk (Existing Hard Disk) in the settings of the second virtual machine. Make sure to select the Sharing mode — Multi-Writer for this disk.
5. What should I remember when migrating a VM with a connected VMDK disk in MultiWriter mode? An error will appear when migrating a VM with a connected VMDK disk in MultiWriter mode. To resolve this issue, you should turn off the VM, and perform cold vMotion.
6. How can I configure a Shared Disk in VMware Workstation? To configure a Shared Disk in VMware Workstation, you can use the vmware-vdiskmanager.exe utility from the command prompt to create a shared disk. Then, add the vmdk file (disk) you created to the first virtual machine and then to the second virtual machine.
7. What happens if I try to write data to a VMDK from the guest operating system? If you try to write data to a VMDK from the guest operating system, then this data (folder) will be visible only on the host that created it. It’s important to note that the Multi-Writer VMDK technology is needed just for clustering, and using it as a shared disk with automatic file synchronization is impossible.
Sharing a disk between multiple VMs on VMware ESXi can be a valuable tool, especially in clustering scenarios. However, it’s crucial to understand the various limitations and steps involved in setting up a shared VMDK file. You can effectively and safely implement this configuration by understanding and adhering to the restrictions of the Multi-Writer mode, creating and adding new SCSI controllers, and properly handling the migration of a VM with a connected VMDK disk.
Moreover, similar procedures can be followed when configuring a shared disk in VMware Workstation, further extending the utility of shared virtual disks. As with all advanced configurations, proper understanding and careful execution are paramount to prevent data loss or corruption.
This would only be good for Oracle RAC is that correct not windows File Shares?
This solution can be used in different Windows failover cluster configurations (MSCS)
I think …. that the MSCS requires SCSI locking / reservations in order to function properly, it does not support simultaneous writes I have tried using the multi-writer flag with a MSCS setup and it failed the pre-deployment validation testing.
MSCS cluster supports the usage of shared Virtual disks on ESXi. But there are certain limitations: the model of the virtual SCSI adapter, the number of nodes, the versions of guest Windows etc.
For more information, see the document:
Setup for Failover Clustering and Microsoft Cluster Service
Yep this is using RDM instead of the multi writer vmdk
Trying to follow these guidelines but it just doesn’t work. Every time I create the virtual disk and go to the second machine and try to add it the second machine says it’s lazily zeroed and not shareable. (it’s thick, eagerly zeroed and says so on the first machine)
You probably have the new SCSI controller configured for Physical. If you switch it over to Virtual, you should be able to see it as eagerly zeroed and able to change the sharing options. I’m assuming you’re trying to share a drive between two VMs running on the same ESXi host.
I got this to work, to a point. Newly Created files/or changes in general on one server are not seen on the other server unless I disconnect/reconnect the shared disk. Any tips on that?
Since both servers don’t know of each other, both servers assume, that they have unique access to the disk. Any changes made by server 1 will therefore not be known to server 2, esp it’s cache, and vice versa.
Using the disk from both servers at the same time will result in a corrupted file system. You have to switch the disk offline at one of the servers.
You can use it for shared data for a kind of “leightweight cluster”, though: Either server 1 or server 2 as the disk online, and you could export the disk as SMB share. If the active server fails or needs some OS patches, you could switch over to server 2.
Even am facing the same issue, do you got any solution for this?
If I do that for 2 or more disks, the order of the disks, as seen in “computer management — storage — disk management” seems to be random, esp. after a server reboot.
Does someone here have an idea, how to know, wich disk no. in “disk mgmt” is wich VM storage?
you have to build out the FOC in windows or swl in order to make this work. putting a “TEST” folder on one vm and it will take a considerable amount of time to show on the other vm if at all until you reboot usually. the FOC in windows or sql will fix that issue.
i am a little disappointed to understand after the fact that this isn’t at all what my client wanted, and i am probably not alone to think that this would have been kind to start this article with sort of “this is for fun purpose only as it will not be able to share anything between two machine”. I am now looking for alternative.
I’m not sure what Victor is talking about. I had a little difficulty making sure I got all the settings correct, but I’ve attached a shared disk to two VMs, and the VMs can run simultaneously, and they can see the same data. I don’t know what the “for fun purpose only” point was, I assume he had some similar difficulties that I did, but I don’t know how he got it to attach the disk but not see the same data. I’m using this for CAD users to have VMs just big enough to install their apps, but then instead of having dedicated storage per VM that goes to waste, have a large shared disk that they can treat as a scratch space before saving their data to our company production data storage.
I have followed this guide exactly but cannot see the same data on the disk. I can see the disk and can read/write files etcc, but the data does not show up on the other VM. Any ideas?
I understand that this is not a shared drive, but shared data storage. On one ESXi host, I have 2 datastores, and one is nearly full. The other is has space. Currently 2 machines are taking up most of the space on the first datastore. It would solve my problem if I could combine these 2 datastores, or make the machines use both. This seems like it would solve my problem, but do I really need to reformat the drives? That’s a lot of work lost.
We also have another ESXi host with a large datastore, so I’d like to combine that too, if I could, so I can migrate machines between hosts when necessary. I guess I’d choose Physical instead of Virtual in that case.
Am I getting it right, though – I would have to reformat the virtual drives on all the VMs?
hi there, thanks for your sharing Infos.
i Setup 1 Disk with Multiwriter.
On both VM’s i got this to work.
I have sync Problems, if i write something on the disk i can’t see it on the other VM until i reboot the VM. Do i Need to make a configuration? thanks alot, adrian
Thank you so much for posting this! I’ve been having a terrible time creating a CSV volume and apparently, it centered around the idea that both nodes were riding on the same ESXi host. Because of that, I needed to switch my RMD shared drive to “virtual” instead of physical. All the documentation I read was countered to this. So, THANK YOU for taking the time to mention this aspect in your article. I was getting to the end of my rope on this one!
Thank you for this post. However I was looking a solution to use with Windows files (IIS cluster). This is not the case for that, as the servers are not aware what other server is writing. To be clear, you write some file with SERVER1, and it doesn’t show up on the SERVER2. You have to OFFLINE -> ONLINE the disk or reboot the server.
Do you have a solution for this?
Guys, any update for the above issue.?
I was able to add a shared disk on 2 VM’s with multi writer but when i add/delete any file from VM1 its not visible on VM2. Any idea’s how to overcome this without rebooting or making the disk offline and then online?
1- Is that your means we had to use multi-write disk just for oracle RAC and Microsoft clustering ?
2- I create 2 vm with server2019 and add second vdisk and set scsi bus sharing and set share type for multiwrite then create this this in the windows then do all these steps for second VM but while write a file in that drive on vm1 not create on vm2 and had to offline /online to see it is that logical?
3 – Due add second scsi (to both VM) and set physical type can do vMotion but while select virtual cannot do vMotion is that logical ?
Hi, thank you for this document
I have problem with that, when I want to add exiting hard for 2nd VM, I got error: Disk sharing is only possible with eagerly zeroed, thick provisioned disks
and I cant change anything? can you please help?
Can you please advise the correct procedure when you come to remove a shared disk from the cluster?
I have several disks presented in this way to a MS SQL failover cluster on 2 VMs
I have paused one of the nodes and drained all roles then shut the VM down.
If I try to click the ‘X’ next to the RDM disk in the Edit Settings it errors and states ‘Cannot complete operation due to concurrent modification by another process’
I have removed the disk from the Cluster Failover Manager so it should not be being used?
I need to share 100 disks on each VM in a 30 node cluster . Any one with Power CLI Script to acheive this manual task of sharing 100 disk on 30 vm’s ? I’d really appreciate.
Guest OS ( RHEL 7.4 ) with veritas clutering ( VCS ) inside.