2 Simple ways to Create Virtual Compatibility RDM Disks

Raw device mapping (RDM) is a mapping file that provides direct access to a LUN on an iscsi or fibre channel storage system for a virtual machine. As we discussed in the earlier post, There are two types of RDM Disks (Virtual Compatibility RDM and Physical Compatibility RDM).  We have explained the detailed 11 differences between RDM Virtual and Physical Compatibility ModeVirtual compatibility RDM disks allow RDM to act exactly like a virtual disk file, including the use of snapshots. In this article, We are going to looking at the detailed procedure to create Virtual Compatibility RDM Disks.

2 Ways to Create Virtual Compatibility RDM Disks

There are 2 simple ways to create virtual compatibility RDM disks. First one is via vSphere Web Client and the second method is using vmkfstools command (CLI).

1.Create Virtual Compatibility RDM Disks using vSphere Web Client

Once the RAW LUN is allocated to the ESXi cluster, Follow the below procedure:

Log in to vCenter Server using vSphere Web Client. Select the virtual machine in the vCenter Server inventory -> Edit Settings. Select RDM Disk from the New Device Dropdown

Create virtual compatibility RDM using vSphere Web Client

Once the RDM Disk is selected in New Device option, Click on Add

Create virtual compatibility RDM using vSphere Web Client

Select the respective LUN to create it as RDM disk in the virtual machine and Click on Ok.

Create virtual compatibility RDM using vSphere Web Client

Select “Virtual” under Compatibility Mode and also you can specify the location of the RDM Mapping file. You can choose either store with the virtual machine or select any specific datastore. Click OK.

Create virtual compatibility RDM using vSphere Web Client

That’s it. The RDM disk is added. you can validate the disk edition from the virtual machine properties.

Create virtual compatibility RDM using vSphere Web Client

You can login to the virtual machine and create a partition on the attached RDM disk. You can see 1 TB RDM disk is attached and it appear as the local disk of Windows virtual machine.

Create virtual compatibility RDM using vSphere Web Client

2. Create Virtual Compatibility RDM Disks using vmkfstools

The second method which I am going to explain is creating virtual compatibility RDM disks using vmkfstools command line from ESXi host.  This method also performs the same operation as what we do it in the Web client. The only advantage of this method is you can create the virtual compatibility RDM mapping file inside any specific folder of the datastore. This will be extremely useful when you have multiple virtual machines sharing the same RDM disks. You can create a specific folder to create the RDM mapping file.

To Create Virtual Compatibility RDM, you need to know the NAA ID of the physical LUN which we are going to add it as RDM disk to the virtual machine.  CD towards the specific folder where you want to keep the RDM mapping file and execute the below command

vmkfstools -r /vmfs/devices/disks/naa.XXXXXXXXXXXXXXXXXXXXXXXXX   diskname.vmdk

Create Virtual Compatibility RDM using vmkfstools

TIP: You can specify the disk name of RDM mapping file in a meaningful way so that it will be easily identified during the maintenance of the LUN’s or disk.  You can use something like VMname-LunID.vmdk.  Example, testvmLUN05.vmdk

You can validate the RDM mapping files are created using “ls” command in the specified directory. You can see 2 files (diskname-rdm.vmdk  & diskname.vmdk)

Create Virtual Compatibility RDM using vmkfstools

You can read the descriptor file “example.vmdk” contains the information about the RDM mapping file. You can see the CreateType as “vmfsRawDeviceMap”

Create Virtual Compatibility RDM using vmkfstools

Once the RDM mapping file is created using vmkfstools. You can Edit the virtual machine properties -> Select “Existing Hard Disk” from the New Device drop-down. Click on Add.

Create Virtual Compatibility RDM using vmkfstools

Browse towards the folder in the datastore in which we have created RDM Mapping file. Select the VMDK and Click Ok.

Create Virtual Compatibility RDM using vmkfstools

Click on Ok to add the RDM disk to the virtual machine.

Create Virtual Compatibility RDM using vmkfstools

You can see the attached RDM disk appear as similar to the virtual disk from the Guest operating system.


Create Virtual Compatibility RDM using vmkfstools

That’s it. We are done with creating virtual compatibility RDM disks in two different methods such as vSphere Web client and also using vmkfstools. I hope this is informative for you. Thanks for reading!!!. Be social and share it with social media, if you feel worth sharing it.