The Task
For this task we had 6 x RHEL6 VMs which someone had asked us to attach the same RDM disk to in a non cluster aware scenario. E.g No SQL/Exchange clustering, just the simple sharing of a LUN between the VMs.
About RDM Mapping
An RDM is a mapping file in a separate VMFS volume that acts as a proxy for a raw physical storage device.
The RDM allows a virtual machine to directly access and use the storage device. The RDM contains metadata for managing and redirecting disk access to the physical device.
The file gives you some of the advantages of direct access to a physical device while keeping some advantages of a virtual disk in VMFS. As a result, it merges VMFS manageability with raw device access. RDMs can be described in terms such as mapping a raw device into a datastore, mapping a system LUN, or mapping a disk file to a physical disk volume. All these terms refer to RDMs.
Although VMware recommends that you use VMFS datastores for most virtual disk storage, on certain occasions, you might need to use raw LUNs or logical disks located in a SAN.
When you give your virtual machine direct access to a raw SAN LUN, you create an RDM disk that resides on a VMFS datastore and points to the LUN. You can create the RDM as an initial disk for a new virtual machine or add it to an existing virtual machine. When creating the RDM, you specify the LUN to be mapped and the datastore on which to put the RDM.
Although the RDM disk file has the same.vmdk extension as a regular virtual disk file, the RDM contains only mapping information. The actual virtual disk data is stored directly on the LUN.
Compatibility Modes
Two compatibility modes are available for RDMs:
- Virtual compatibility mode allows an RDM to act exactly like a virtual disk file, including the use of snapshots.
- Physical compatibility mode allows direct access of the SCSI device for those applications that need lower level control.
Instructions
- Log into vCenter and go to the first VM and click Edit Settings. Note the VM will need to be powered off for you to configure some settings further on in the configuration.
- Click Add and choose Hard Disk
- Choose Raw Disk Mapping
- Select the Raw Disk you want to use
- Select whether to store it with the VM or on a separate datastore
- Choose a Compatibility Mode – Physical or Virtual. We need to choose Physical
- Choose a SCSI Device Mode. This will also need to be the same on the second machine you are going to add the same RDM to.
- Click Finish
- Next go the second VM and click Edit Settings and click Add
- Click
- Click Choose an Existing Disk
- You now need to browse to the Datastore that the first VM is one and find the RDM VMDK file and select this
- In Advanced Options, select the same SCSI ID that the first VM containing the RDM is on
- Click Finish and the Edit Settings box will come up again
- You need to change the SCSI Bus Sharing on the Controller to Physical to Allow Sharing
- Click OK
- You should now have a shared RDM between 2 VMs
- Power on the VMs
Problems: Incompatible Device backing for device 0
We actually encountered an issue where we tried to accept the settings on the second VM and got the following error message
We resolved it by having a member of our storage team recreating the LUNS we needed to add on the SAN. When sharing MSCS RDM LUNs between nodes, ensure that the LUNs are uniformly presented across all ESXi/ESX hosts. Specifically, the LUN ID for each LUN must be the same for all hosts.
In our case with VMware and Windows clusters we use the IBM v7000 GUI to map the LUNs which is easier – It assigns the first available SCSI ID. No issues with these Operating Systems.
But with Red Hat it didn’t work, because it uses SCSI ID together with WWNs. So we had to use v7000 CLI to map the LUNs with one and the same SCSI ID to every host
Just like to add a small comment, if you already have an preexisting virtual drive, an hd1, you need to select one scsi address as (1.0) in order to create a second scsi controler, so when you change from none to physical that do not affect the first and preexisting virtual driver.
Yes great advice thanks very much. Thanks for your comment 🙂
What can i do if i want one VM can see files of other VM?
you have to configure shared disks at VM level
check this link for more details
https://communities.vmware.com/blogs/Abhilash_hb/2013/08/25/clustering-using-sharing-of-vmdks-between-virtual-machines
hi
I created RDM between 2 non-clustered VMs, but i need sync data realtime.
Can you help me?
You might want to turn the Multi-writer flag in the advanced options of VM so you can let the machines write to the disk. Follow the below link
VMware KB: Disabling simultaneous write protection provided by VMFS using the multi-writer flag
https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1034165
thanks for your reply.
but after this steps also when i crete file in VM1 cant’t see in VM2 untill reboot vm or offline & online Disk!
Have u set the multi writer flag on both VMs.
We have also seen in vSphere 6 it has to be set in VM Settings in the web client rather than the older client or the settings can disappear.
What O/S are you using?
I using 2 host(ESXi6)
2 VM ( Windows Server 2012)
I add this line to both .vmx file(scsi1:1.sharing = “multi-writer”)
Any status on this? Followed this KB from VMware and (Disabling simultaneous write protection provided by VMFS using the multi-writer flag ). We need our changes/data to synch realtime. This is currently not happening.
https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1034165
Has anyone figured this out? Any help is much appreciated.
~ Rhiannon
What application are you using on your VMs for sharing data? At present we have used this in an Oracle RAC scenario. One of the other parts of the configuration parameters we had to add to the VM was the line Disk.EnableUUID which has a value of true but this may not be appropriate for your environment.
We are using Windows Server 2012 R2 with the .vdmk as an attached disk (shared storage). Thanks for replying.
~ Rhiannon
Is there a script to perform the above task
Yes there is but it is stated as unsupported n the link below
https://communities.vmware.com/docs/DOC-24873
¿ Is there a performance difference when adding the RDM disk “as Existing Disk” rather than directly attaching the LUN directly?
If 1 Storage controller got reboot and its doing TAKEOVER within 25 Sec then How much time require to RDM to re-connect to the VM