Adding shared RDM’s to multiple VMs in VMware vSphere 5.5

RDM2

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.

RDM

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.

rdm1

  • Click Add and choose Hard Disk

rdm2

  • Choose Raw Disk Mapping

rdm3

  • Select the Raw Disk you want to use

rdm4

  • Select whether to store it with the VM or on a separate datastore

rdm5

  • Choose a Compatibility Mode – Physical or Virtual. We need to choose Physical

rdm6

  • 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.

rdm7

  • Click Finish
  • Next go the second VM and click Edit Settings and click Add

rdm8

  • Click

rdm9

  • Click Choose an Existing Disk

rdm10

  • You now need to browse to the Datastore that the first VM is one and find the RDM VMDK file and select this

rdm11

  • 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

rdm12

  • 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

lun

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

 If the LUN IDs are not the same across hosts, contact your storage admin, team or storage vendor to change the LUN ID appropriately. It is a better practice to assign the LUN to a new, previously unused ID and present the LUN under the new ID to the cluster.

16 comments

  1. Rodrigo says:

    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.

  2. Hossein says:

    What can i do if i want one VM can see files of other VM?

  3. sdb says:

    hi
    I created RDM between 2 non-clustered VMs, but i need sync data realtime.
    Can you help me?

  4. admin says:

    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

    • sdb says:

      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!

  5. admin says:

    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?

    • sdb says:

      I using 2 host(ESXi6)
      2 VM ( Windows Server 2012)
      I add this line to both .vmx file(scsi1:1.sharing = “multi-writer”)

  6. Rhiannon says:

    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

    • admin says:

      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.

      • Rhiannon says:

        We are using Windows Server 2012 R2 with the .vdmk as an attached disk (shared storage). Thanks for replying.

        ~ Rhiannon

  7. saranya says:

    Is there a script to perform the above task

  8. Daniel says:

    ¿ Is there a performance difference when adding the RDM disk “as Existing Disk” rather than directly attaching the LUN directly?

  9. imran says:

    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

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.