Multi-Writer Shared Disk for Two VMs with VCF Automation and Orchestrator

VCF Automation won’t share one disk between two VMs. Build it with a cloud template and an Orchestrator subscription that sets multi-writer and attaches the VMDK to the second VM, then see why Windows node B needs a refresh.

Banner: Multi-Writer Shared Disk for Two VMs with VCF Automation and Orchestrator. Node A (read-write) and node B (read-only) on different hosts both point to one shared.vmdk with multi-writer on SCSI 1:0.
In this article

A disk that two VMs can both see is a common ask: Oracle RAC, Linux clusters, or simply two Windows servers that need the same files. vSphere supports it through the multi-writer flag, but VCF Automation will not build it for you from a cloud template. In this post I build it with a cloud template and an Orchestrator event subscription, then test what Windows actually does with the shared disk, including the part that surprises most people: the second node does not see new writes until you refresh it.

Tested on: VCF Automation 9.1.1 (VM Apps) with the embedded VCF Operations Orchestrator 9.1.1 (build 25643527), vSAN datastore on VCF 9.x, two Windows Server 2022 VMs.

Dilemma

You try to create a shared disk in Aria Automation Template, it won’t throw any error in the YAML editor but as soon as you would run it, it would detect that you passed same disk id to both VMs and failed with the error Shared Disk is not supported.

You might have read the VMware article on Shared disk concept and how they strategized its provisioning. https://blogs.vmware.com/vov/2023/10/27/ready-set-go-the-benefits-of-automating-oracle-rac-deployment/

Error message indicating that shared disk configuration is not supported in Aria Automation when using the same disk ID for multiple VMs.

What multi-writer actually does

Normally VMFS and vSAN lock a VMDK so only one VM can open it read-write. The multi-writer flag (sharing = sharingMultiWriter on the disk backing) removes that lock, so several VMs can open the same VMDK. That is all it does. It does not make the data safe to share: the guest operating systems must coordinate who writes which blocks.

  • The vSphere API only allows multi-writer on eager zeroed thick disks. On vSAN, a disk created as eager zeroed thick by VCF Automation worked without changing the storage policy.
  • Put the disk in independent persistent mode. It is not strictly required, but with the default dependent mode, snapshots fail with “cannot snapshot shared disk”.
  • Every VM that shares the disk uses the same VMDK path, and the same SCSI controller and unit number is the easiest to keep track of (I use SCSI 1:0).

⚠️ Same-host rule: VMs that share a multi-writer disk are not allowed to power on when they sit on the same ESXi host. With DRS in fully automated mode they can easily land together, so the workflow below adds a mandatory VM-VM anti-affinity rule before powering the VMs back on.

The approach: cloud template + Orchestrator EBS

Since the template cannot hand one disk to two machines, the work is split:

  1. Cloud template: creates the shared disk (eager zeroed thick, SCSI 1:0) and attaches it to node A only. Node B gets custom properties that say “you are the secondary, your peer is node A”.
  2. Compute Post Provision subscription: runs an Orchestrator workflow for node B. It waits for sysprep, prepares both guests, shuts both VMs down, turns on multi-writer on node A’s disk, attaches the same VMDK to node B, adds the anti-affinity rule and powers both VMs on.

Cloud template

I use imageRef plus CPU and memory inputs instead of image and flavor mappings, so the template runs in another environment after a copy-paste. Referencing ${resource.node-a.resourceName} on node B also makes VCF Automation build node A first.

formatVersion: 1
# LAB - Windows - Multi-Writer Shared Disk
# Two Windows VMs that share one multi-writer disk.
# - shared-disk: eager zeroed thick, SCSI 1:0, attached to node-a by VCF Automation
# - node-b carries labSharedDiskRole=secondary and labSharedDiskPeer=<node-a VM name>;
# Compute Post Provision EBS "LAB - EBS - CompProv Post - Attach Multi-Writer Disk"
# shuts both VMs down, sets the disk to multi-writer (independent persistent),
# attaches it to node-b on SCSI 1:0, adds a VM-VM anti-affinity rule and powers both on.
# Lab test only: NTFS is not cluster-aware - keep the disk online on one node at a time.
inputs:
vmName:
type: string
title: VM name prefix
description: Node A gets -a, node B gets -b (e.g. mwd01 -> mwd01-a, mwd01-b). Lowercase letters, digits and hyphens, up to 12 chars.
pattern: '^[a-z][a-z0-9-]{0,11}$'
default: mwd01
imageRef:
type: string
title: vSphere template
default: windows2022_template
cpuCount:
type: integer
title: vCPUs
minimum: 1
maximum: 16
default: 2
memoryMb:
type: integer
title: Memory (MB)
minimum: 2048
maximum: 65536
default: 4096
sharedDiskGb:
type: integer
title: Shared disk size (GB)
minimum: 1
maximum: 500
default: 10
resources:
shared-disk:
type: Cloud.vSphere.Disk
properties:
capacityGb: ${input.sharedDiskGb}
provisioningType: eagerZeroedThick
SCSIController: SCSI_Controller_1
unitNumber: 0
node-a:
type: Cloud.vSphere.Machine
properties:
name: ${input.vmName + "-a"}
imageRef: ${input.imageRef}
cpuCount: ${input.cpuCount}
totalMemoryMB: ${input.memoryMb}
customizationSpec: windows
labSharedDiskRole: primary
attachedDisks:
- source: ${resource.shared-disk.id}
networks:
- network: ${resource.mgmt-net.id}
node-b:
type: Cloud.vSphere.Machine
properties:
name: ${input.vmName + "-b"}
imageRef: ${input.imageRef}
cpuCount: ${input.cpuCount}
totalMemoryMB: ${input.memoryMb}
customizationSpec: windows
labSharedDiskRole: secondary
# Read by the EBS workflow; also makes node-b wait for node-a
labSharedDiskPeer: ${resource.node-a.resourceName}
labSharedDiskUnit: 0
networks:
- network: ${resource.mgmt-net.id}
mgmt-net:
type: Cloud.vSphere.Network
properties:
networkType: existing
constraints:
- tag: net:lab-vm-mgmt

Subscription

SettingValue
Event topicCompute post provision
Conditionevent.data.customProperties['labSharedDiskRole'] == 'secondary'
WorkflowLAB – EBS – CompProv Post – Attach Multi-Writer Disk
BlockingYes, timeout 60 minutes (sysprep can take a while)

The workflow, step by step

  1. Find node B by instanceUUID on the vCenter named in the payload (vcUuid), and node A by name from labSharedDiskPeer.
  2. Wait for the CustomizationSucceeded event on both VMs, so we never shut a VM down in the middle of sysprep.
  3. Through Guest Ops: format the shared disk on node A as S:, and on node B set the new-disk policy to OfflineAll so B will not mount the disk on its own.
  4. Shut both guests down (graceful, with a power-off fallback).
  5. Reconfigure node A’s disk to multi-writer and independent persistent, then add the same VMDK to node B at the same SCSI address.
  6. Add the mandatory anti-affinity rule and power both VMs on.

Finding the controller and the disk at a given SCSI address:

function isScsiController(device) {
// The abstract VcVirtualSCSIController does not match instanceof in vRO; SCSI controllers are the devices with sharedBus
return device.sharedBus !== undefined && device.sharedBus !== null && device.busNumber !== undefined;
}
function getController(vm, busNumber) {
var devices = vm.config.hardware.device;
for (var i = 0; i < devices.length; i++) {
if (isScsiController(devices[i]) && devices[i].busNumber === busNumber) {
return devices[i];
}
}
return null;
}
function getDiskAt(vm, controllerKey, unitNumber) {
var devices = vm.config.hardware.device;
for (var i = 0; i < devices.length; i++) {
if (devices[i] instanceof VcVirtualDisk && devices[i].controllerKey === controllerKey && devices[i].unitNumber === unitNumber) {
return devices[i];
}
}
return null;
}

💡 vRO gotcha: devices[i] instanceof VcVirtualSCSIController returns false for real controllers in Orchestrator 9.1.1. Only the concrete classes match (VcParaVirtualSCSIController, VcVirtualLsiLogicSASController and so on). My first version of the workflow failed on this; checking for the sharedBus property is the simplest fix.

Turning on multi-writer for node A and attaching the same VMDK to node B:

// Node A: set the existing disk to multi-writer, independent persistent
if (diskA.backing.sharing !== "sharingMultiWriter" || diskA.backing.diskMode !== "independent_persistent") {
diskA.backing.sharing = "sharingMultiWriter";
diskA.backing.diskMode = "independent_persistent";
var editA = new VcVirtualDeviceConfigSpec();
editA.operation = VcVirtualDeviceConfigSpecOperation.edit;
editA.device = diskA;
reconfigure(nodeA, [editA], "Multi-writer on " + nodeA.name);
}
// Node B: same controller type on bus 1 if missing, then attach the same VMDK
var changesB = [];
var ctrlB = getController(nodeB, SHARED_BUS);
var ctrlKeyB;
if (ctrlB) {
ctrlKeyB = ctrlB.key;
if (getDiskAt(nodeB, ctrlKeyB, unitNumber)) {
throw nodeB.name + " already has a disk at SCSI " + SHARED_BUS + ":" + unitNumber;
}
} else {
var newCtrl = newControllerLike(ctrlA);
var addCtrl = new VcVirtualDeviceConfigSpec();
addCtrl.operation = VcVirtualDeviceConfigSpecOperation.add;
addCtrl.device = newCtrl;
changesB.push(addCtrl);
ctrlKeyB = newCtrl.key;
}
var backing = new VcVirtualDiskFlatVer2BackingInfo();
backing.fileName = vmdkPath;
backing.diskMode = "independent_persistent";
backing.sharing = "sharingMultiWriter";
var diskB = new VcVirtualDisk();
diskB.key = -102;
diskB.controllerKey = ctrlKeyB;
diskB.unitNumber = unitNumber;
diskB.capacityInKB = diskA.capacityInKB;
diskB.backing = backing;
var addDisk = new VcVirtualDeviceConfigSpec();
addDisk.operation = VcVirtualDeviceConfigSpecOperation.add;
addDisk.device = diskB;
changesB.push(addDisk);
reconfigure(nodeB, changesB, "Attach shared VMDK to " + nodeB.name);

The anti-affinity rule:

function addAntiAffinityRule(vmA, vmB) {
var cluster = vmA.runtime.host.parent;
var ruleName = "LAB-MultiWriter-" + vmA.name + "-" + vmB.name;
var rules = cluster.configurationEx.rule || [];
for (var i = 0; i < rules.length; i++) {
if (rules[i].name === ruleName) {
System.log(LOG_PREFIX + "Anti-affinity rule " + ruleName + " already exists");
return;
}
}
var rule = new VcClusterAntiAffinityRuleSpec();
rule.name = ruleName;
rule.enabled = true;
rule.mandatory = true;
rule.vm = [vmA, vmB];
var ruleSpec = new VcClusterRuleSpec();
ruleSpec.operation = VcArrayUpdateOperation.add;
ruleSpec.info = rule;
var spec = new VcClusterConfigSpecEx();
spec.rulesSpec = [ruleSpec];
waitTask(cluster.reconfigureComputeResource_Task(spec, true), "Anti-affinity rule " + ruleName + " on " + cluster.name);
}

Workflow log from the lab run (about two minutes end to end):

[LAB][AttachMultiWriterDisk] Node A: mwd01-a010 | Node B: mwd01-b011 | shared disk SCSI 1:0
[LAB][AttachMultiWriterDisk] Shared VMDK: [VCF-MGMT-DS-VSAN] 7028f86a-9408-c121-fe2b-3868dd37ca60/shared-disk-mcm7-343041765310.vmdk (10 GB, sharing sharingNone)
[LAB][AttachMultiWriterDisk] Guest customization succeeded on mwd01-a010
[LAB][AttachMultiWriterDisk] Guest customization succeeded on mwd01-b011
[LAB][AttachMultiWriterDisk] Guest steps [init] on mwd01-a010, attempt 1
[LAB][AttachMultiWriterDisk] Guest steps [sanpolicy] on mwd01-b011, attempt 1
[LAB][AttachMultiWriterDisk] mwd01-a010 is powered off
[LAB][AttachMultiWriterDisk] mwd01-b011 is powered off
[LAB][AttachMultiWriterDisk] Multi-writer on mwd01-a010 done
[LAB][AttachMultiWriterDisk] Attach shared VMDK to mwd01-b011 done
[LAB][AttachMultiWriterDisk] Anti-affinity rule LAB-MultiWriter-mwd01-a010-mwd01-b011 on VCF-MGMT-cl01 done
[LAB][AttachMultiWriterDisk] mwd01-a010 is up (host vcf-m-esx04.vmw.lab)
[LAB][AttachMultiWriterDisk] mwd01-b011 is up (host vcf-m-esx02.vmw.lab)
[LAB][AttachMultiWriterDisk] Multi-writer disk shared between mwd01-a010 and mwd01-b011

Guest steps without cloudbase-init

My Windows template has no cloudbase-init, so the in-guest steps run through Guest Ops (VMware Tools) with one PowerShell resource element and a list of steps passed as a variable. No network access to the VM is needed.

StepWhat it does
initBrings the disk online and, if it is RAW, creates GPT + NTFS volume S: (label SHARED)
sanpolicySet-StorageSetting -NewDiskPolicy OfflineAll, so the node does not auto-mount new disks
readonlySets the disk read-only first, then brings it online as S:
refreshTakes the disk offline and back online read-only, to drop the NTFS cache
flushWrite-VolumeCache -DriveLetter S on the writer
write / read / offlineTest helpers: append a line to S:\mwd-test.txt, print it, release the disk

The result

After the workflow, node A has the shared disk as SHARED (S:):

Node B does not show it at all. That is on purpose: the disk is attached, but offline on B.

🔍 Proof it is one disk: run Get-Disk on both nodes. The shared disk has the same serial number on both (6000c291f54b5c9eea13a70a5acf70f2 in my lab), because Windows takes the serial from the VMDK. The boot disks have different serials.

Reading the disk from node B on Windows

NTFS is not cluster-aware. If both Windows nodes mount the volume read-write, they overwrite each other’s metadata and the volume gets corrupted. So on Windows the safe pattern is: node A reads and writes, node B mounts read-only. Set read-only before bringing the disk online, so Windows never writes to it:

Set-Disk -Number 1 -IsReadOnly $true
Set-Disk -Number 1 -IsOffline $false

In my test the volume came back as S: on its own. If it shows up without a letter, assign one with Set-Partition -NewDriveLetter.

How to verify node B is write-protected

Run this on both nodes:

Get-Disk | Select-Object Number, isReadOnly

Output on node B:

Number isReadOnly
------ ----------
0 False
1 True

Node A shows False for the same disk, with the same serial number:

The catch: node B does not see new writes

This is the part worth testing yourself. Node B mounts the volume at one point in time and from then on works from its own NTFS cache in memory. The two Windows instances do not share cache state, so nothing tells B that A changed the disk.

I timed it through Guest Ops (guest clock times):

TimeNodeWhat happened
18:09:02AAppended a line and ran Write-VolumeCache, so the data is on disk
18:10:21BRead the file: old content
18:12:10BRead again, three minutes later: still old content
18:12:11BRefresh (offline, then online read-only): 516 ms
18:12:12BRead again: new content

So there is no waiting time that fixes it. B only picks up changes when its cache is dropped: the disk going offline and online, a reboot, or Windows evicting cached pages under memory pressure (unpredictable, and it can mix fresh data with stale metadata). The reliable sequence is a flush on A:

Write-VolumeCache -DriveLetter S

followed by a refresh on B (offline, read-only, online):

Set-Disk -Number 1 -IsOffline $true
Set-Disk -Number 1 -IsReadOnly $true
Set-Disk -Number 1 -IsOffline $false

Output from my refresh run on node B:

== read on MWD01-B011 at 18:12:10.209
MWD01-A010 wrote at 2026-11-14T09:33:07.7351063-12:00
MWD01-B011 wrote at 2026-11-14T09:33:19.0410003-12:00
New test
== refresh on MWD01-B011 at 18:12:11.834
Refreshed (offline -> online read-only) in 516 ms
== read on MWD01-B011 at 18:12:12.475
MWD01-A010 wrote at 2026-11-14T09:33:07.7351063-12:00
MWD01-B011 wrote at 2026-11-14T09:33:19.0410003-12:00
New write on 15-11-2026MWD01-A010 wrote at 2026-11-15T18:09:02.8954372-12:00

Close and reopen any file that was already open on B; Notepad, for example, keeps its own copy in memory.

When both VMs must write

Multi-writer plus NTFS gives node B point-in-time reads, which is fine for things like picking up reports or checking backups. If both nodes need to write, or B needs a live view, use something that coordinates the writes:

Use caseWhat makes it safevSphere disk setup
Windows servers sharing filesAn SMB share (file server, NAS or vSAN File Services). SMB handles the locking.No shared VMDK
Windows active-active storageWSFC with Cluster Shared Volumes (CSV)Clustered VMDK or RDM, SCSI bus sharing Physical. Check the support matrix.
SQL Server FCIWSFC disk ownership: one active node writes, the disk fails overClustered VMDK or RDM, SCSI bus sharing Physical
Oracle RAC (Windows or Linux)Oracle ASM / ClusterwareMulti-writer, the original use case
Linux clustersGFS2 or OCFS2 with a lock managerMulti-writer
One writer, many readersReaders mount read-only and refreshMulti-writer (this post)

⚠️ Before you delete the deployment: both VMs reference the same VMDK. Destroying node B deletes the shared disk too, which can then make node A’s delete fail, and the DRS rule stays behind. Detach the disk from node B first (or add a Compute Removal Pre subscription that does it), and remove the anti-affinity rule.

Download from GitHub

Everything is in the multi-writer-shared-disk-vcfa folder of my cloudblogger.co.in repo: the cloud template, the workflow script, the guest PowerShell script and a README with the setup steps.

📦 vRO package in.co.cloudblogger.multiwriterdisk (workflow, Guest OS Script Engine, guest script and the config element without the password): download it from GitHub, or peek inside this package in vRO Peekage without importing it. After import, set guestPassword in LAB/Storage/LAB_MultiWriterDisk.

Wrapping up

VCF Automation will not share a disk between machines on its own, but a small Orchestrator subscription closes the gap: multi-writer on the disk, the same VMDK on the second VM, and an anti-affinity rule so both can power on. The vSphere part is the easy bit. The real question is what the guest does with a shared disk, and on Windows with NTFS the answer is one writer, readers that refresh. For the Linux version with a cluster file system, where both nodes really write at the same time, see Multi-Writer GFS2 Disk for Two Ubuntu VMs with VCF Automation and Orchestrator.

References


Discover more from Cloud Blogger

Subscribe to get the latest posts sent to your email.

Enjoyed this post?

Was this helpful?

Leave a Reply