VMware

Share VMDK Data Between VMs Multi-Writer Disk Without Cluster File System

Share VMDK Data Between VMs Multi-Writer Disk Without Cluster File System shows a way to copy and share data without clustering and network connectivity

Recently, in working with a client with many different lab environments, there arose the need to copy SQL backups from one lab and restore into a number of other labs. The DB in question was a DB that was around 250 GB. Copying via the network between labs was going to be a nightmare both in terms of performance and in terms of how the lab environments were segregated between the various SQL DBs. Instead of utilizing the network to copy the SQL DB, I had an idea to instead use a shared VMDK between the various lab hosts and allow all the VMs needed to be able to see the VMDK and then copy the data from this shared VMDK between the VMs. Let’s take a look at how to Share VMDK Data Between VMs Multi-Writer Disk Without Cluster File System to take a look at a bit of a hack of the technology to allow using this approach without running a cluster file system between VMs.

Sharing Data with Multi-Writer Disks Use Cases

I have already alluded to the potential use cases of a multi-writer disk shared between servers. Reading and writing data to disk and sharing that data between multiple VMs means you are saving the step of having to duplicate the data by having to copy it across a network and store it on the target VM.

This is especially helpful if you have a large file or large amount of data you need to copy from one VM to another. The data is simply “local” to the VM if you are using a shared multi-writer disk in VMware. This means you only have to write data once.

Additionally, there can be network constraints or complexities between VMs in an environment such as between labs that can be a challenge to copying data in a timely and efficient manner between VMs that may exist in different lab environments.

There is a challenge however with multi-writer VMDKs when looking to use them to share data between VMs in that you need to have a cluster aware file system to be able to simultaneously access the data between various VMs. In the Windows world, this would be using Windows Failover Cluster to negotiate and allow reading and writing between the cluster hosts to the same volume.

In my case, I didn’t need or want to configure a cluster between the VMs in question. I simply wanted to quicky be able to copy and access data between VMs without the time needed to copy across the network, and have the double write penalty of copying to a local disk, then copying across a network to another disk, and then reading that data into the VM. In my case this was a SQL backup.

VMware Multi-Writer VMDK Requirements and Considerations

The following requirements are found in the VMware Multi-Writer Attribute for Shared VMDKs online doc from VMware. What are those ones to note?

  • Cluster-aware file systems to avoid corruption
  • When using the multiwriter mode, the virtual disk must be eager-zeroed thick (EZT). When creating an EZT disk on vSAN, the disk is not zeroed automatically. If zeroing is required, use the vmkfstools -wcommand to zero-out all blocks. For more information, see VMware knowledge base article 1033570, โ€œPowering on the virtual machine fails with the error: Thin/TBZ disks cannot be opened in multiwriter mode.โ€
  • Shared VMDKs need not be set to independent persistent mode for the multiwriter attribute

If you notice the first mention is a cluster-aware file system. This is standard protection for a good reason. If you have non cluster aware hosts trying to access (read/write) to the same files, corruption is a good possibility and is probably likely.

Let’s look at a way with Windows Server you can “cheat” this so to speak if you don’t have a cluster configuration such as Windows Failover Cluster services running between VMs.

Share VMDK Data Between VMs Multi-Writer Disk Without Cluster File System

Let’s first look at how to create a multi-writer VMDK to an existing virtual machine. The first thing you need to do is add an additional SCSI Controller for use with the multi-writer VMDKs. I have’t tested this but I don’t think this is absolutely required, but recommended.

Adding-an-additional-SCSI-controller-for-the-VM-to-add-a-multi-writer-VMDK
Adding an additional SCSI controller for the VM to add a multi-writer VMDK

After adding the SCSI Controller, you can see the New SCSI controller listed ready to be added.

New-SCSI-controller-added-to-the-VM

Now, let’s actually add the new Hard Disk.

Adding-a-multi-writer-VMDK-to-the-virtual-machine
Adding a multi-writer VMDK to the virtual machine

Below, for demonstration purposes, I am adding a small 10 GB drive. Based on the requirements for multi-writer, you must use the following configuration settings:

  • thick provision eager zeroed disk
  • Sharing is set to multi-writer
  • Disk mode is set to Independent – Persistent
Setting-the-configuration-for-the-multi-writer-VMDK-for-sharing-data-between-VMs
Setting the configuration for the multi-writer VMDK for sharing data between VMs

This will create a new multi-writer VMDK to the source VM. Once the VMDK is created, we can add it to another VM. On your target VM that you would like to add the multi-writer VMDK, select to add Existing Hard Disk.

Add-the-existing-multi-writer-hard-disk-to-another-VM
Add the existing multi-writer hard disk to another VM

Select the new multi-writer VMDK from the VMware datastore.

Select-the-multi-writer-VMDK-from-the-datastore-to-add-to-the-existing-VM
Select the multi-writer VMDK from the datastore to add to the existing VM

On the second VM and all successive VMs, you will see the VMDK added and the size is greyed out since you can’t change it. A point to note here. Simply adding the multi-writer VMDK will not be recognized as a multi-writer VMDK. Those same settings need to be configured on the second VM as well including sharing and disk mode configuration.

Configure-the-settings-for-the-added-multi-writer-VMDK-on-the-target-machine
Configure the settings for the added multi-writer VMDK on the target machine

Once the VMDK is added, open disk management and online, initialize, and format the disk.

Provision-the-multi-writer-volume-on-the-VM
Provision the multi-writer volume on the VM

Here, on the source VM, I first created the SharedVMFolder on the new volume. After “onlining” the disk on the second VM, I created the Test folder to show the behavior.

Demonstrating-the-behavior-of-how-files-are-visible
Demonstrating the behavior of how files are visible

To understand how the behavior of non-cluster VMs work, notice that since I onlined the disk on the second VM before the second folder was created, the Test folder is not visible.

New-folder-is-not-visible-on-target-host
New folder is not visible on target host

If I Offline and Online the disk on the second VM, let’s see what happens.

Offline-the-multi-writer-volume
Offline the multi-writer volume

Onlining the disk on the second VM.

Online-the-multi-writer-VMDK-volume
Online the multi-writer VMDK volume

Now, we see the folder appear.

The-added-folder-on-the-source-host-is-now-visible-on-the-target-server
The added folder on the source host is now visible on the target server

You are beginning to see the process to use multi-writer VMDKs for a non-Cluster configuration. Of course, this is not a supported use of this functionality. However, this is a really cool “hack” if you will on using the multi-writer disk.

If you need to have the quickest copy of data between VMs that are not clustered and you can’t or do no want to use network copies for time and efficiency.

To review the process to rapidly copy data using a multi-writer VMDK to copy data or share data between VMs without cluster or network:

  • Create the multi-writer VMDK
  • Add the multi-writer VMDK to the additional VM(s)
  • Online the disk on the source VM you want to copy data from
  • Copy the data to the VMDK
  • Offline the disk on the source VM
  • Online the disk on the target VM
  • Copy the data from the VMDK that is now onlined
  • Once finished offline the disk

Wrapping Up

Share VMDK Data Between VMs Multi-Writer Disk Without Cluster File System is a cool way although unsupported to copy or quickly share data between VMs without network connectivity. Additionally, as shown, you can do this without clustering such as Windows Failover Clustering although it is not documented as possible. As engineers and architects however, we bend the rules and look for creative ways to solve problems.

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.