Shared VMDK Disk Between Multiple VMs On VMware ESXI

Hello my dear readers. I hope you are doing well. Today I will tell you about that shared vmdk disk multiple VM on vCenter. VMware allows you to share the same virtual disk (.VMDK file) between 2 (or more) virtual machines running on different VMWare ESXi hosts or between VMs on VMware Workstation. Two or more virtual machines can read and write to a shared VMDK file simultaneously. This configuration is most commonly used in clustering scenarios.

VMware provides several options for the organization of shared disk resources for clustering scenarios (such as Oracle RAC and Windows Server Failover Cluster/WSFC):

  • Multi-writer VMDK — this disk operation mode allows you to share the same VMDK file between multiple VMs (cluster nodes).
  • Shared VMDK on clustered datastore — starting with vSphere 7.0, it is recommended to use VMDKs on clustered datastore as shared disk resources instead of multi-writers for WSFC clusters.
Sharing a VMDK Disk Between Two Virtual Machines on VMware ESXi Hosts

Suppose you have two ESXi hosts with a shared datastore. These hosts are running two VMs (node1 and node2) that you want to add a shared virtual disk to.

First, you need to add a new SCSI controller on both virtual machines.

In the vSphere Client inventory select the first virtual machine (Node 1) and select Actions > Edit Settings.

Select Add New Device > SCSI controller in the dropdown list, and press the Add button.

Select LSI Logic SAS as the type of SCSI controller. Be sure to create a new SCSI controller, don’t use a default SCSI 0 controller.

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.

You need to set scsi settings as above. 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 or vVOLs datastore).
  • 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 VMDK you want to share.

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 an existing new 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.

You will also need to enable the Multi-Writer sharing mode for this virtual disk.

Make sure you use the same SCSI device address for a shared vmdk disk on both virtual machines. 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

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. When we run the ‘fdisk -l’ command on both Linux machines, the disk will appear.

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir