My Notes on Raw Device Mapping (RDM)

Raw Device Mapping aka RDM is a way for providing virtual machine direct access to LUN on the SAN storage. The LUN presented to VM can be then formatted with any filesystem like NTFS or FAT for Windows OS and thus there is no need to format the LUN with VMFS filesystem and then place a vmdk on it.

RDM can be think of as a symbolic link from a VMFS volume to the Raw LUN. When an RDM is mapped to a virtual machine, a mapping file is created.This mapping file acts as a proxy for the physical device and contains metadata used for managing and redirecting access to the raw disk.

When the virtual machine tries to access the LUN, the mapping file is read to obtain the reference to the raw LUN and then the reads and writes go directly to the raw LUN rather than going through the mapping file.


RDM Compatibility Mode

RDM can be configured to operate in virtual compatibility mode or physical compatibility mode. Lets discuss about these in a bit detail.

Physical Compatibility Mode

In physical compatibility mode, RDM’s have almost complete direct access to the SCSI device and there is minimal SCSI virtualization of the mapped device. The Esxi host VMkernel passes all SCSI commands (except Report LUN command) directly to the SAN device.

Physical mode RDM is used for SAN aware applications running inside guest os. If a virtual machine has SAN management software installed in it, the SAN management agent tend to need direct access to the device, without having the SCSI commands intercepted by the host/virtualized.

A use case for using RDM in physical mode is Microsoft clustering service. You can read more about this in this doc

Virtual Compatibility Mode

Virtual compatibility mode supports a subset of SCSI commands to be passed through the hypervisor for communication between guest os and a mapped RDM. In this mode, the VMkernel sends only READ and WRITE to the mapped device. The mapped device appears to the guest operating system exactly the same as a virtual disk file in a VMFS volume.


Advantage of RDM over VMFS

In addition to allowing the pass-through of SCSI commands, the use of RDM can be beneficial for performance reasons. This is due to the fact that VMFS datastore is shared among multiple virtual machines, and thus the IO’s are also shared. Some applications have specific IO requirements which can’t be guaranteed via virtual SCSI disks.

Since RDM is presented directly to a virtual machine and can’t be used by any other VM, you are exposing the full IO capabilities of the underlying LUN to the virtual machine. Although similar performance (IO) requirement can be gained by placing a single VM on a VMFS datastore that fully utilizes the datastore.

Physical vs RDM: Which one to chose?

There are certain pros and cons associated with RDM in physical and virtual compatibility mode. Below table summarizes few of them.


For more info on capabilities and limitations pf physical/virtual RDM, please refer VMware KB-2009226

How to create RDM?

The first step to adding a RDM to a virtual machine is to assign an unused LUN to your ESXi Servers.

In my lab I am using openfiler for shared storage and I created a LUN on openfiler and mapped it to target. On re-scanning the HBA of my Esxi host, I was able to see the newly created LUN.


Now select the VM to which you want to map RDM and power-off the VM (RDM can’t be added while vm is running)

Right click on vm and select Edit settings and click on New Device and select RDM and click Add.


Select the LUN from the list which you want to assign to the VM. In my case I have only one LUN.


Post adding the LUN to the VM as RDM, you can change the compatibility mode and SCSI controller settings etc. Also you can chose the RDM location same as where virtual machine files are stored, or you can specify a datastore where the mapping file will e stored.


Here is an example of RDM mapping file for a VM called Win-Test which has pRDM LUN.


If you open the descriptor file of normal SCSI disk and an RDM disk, you will notice differences as shown in below image:


Note: For virtual RDM, create type is “vmfsRawDeviceMap”.

Also for physical RDM you will not find any -ctk.vmdk file which essentially means that change tracking is not applicable for physical RDM. Technically it means “No Snapshot” for physical RDM.

How to change the RDM type?

At any point of time, a physical RDM can be converted into virtual RDM and vice versa. To change the RDM type follow below steps:

a) Shutdown the VM where RDM is mapped.

b) Edit settings of VM and delete the HDD which represents RDM.

c) Edit VM settings again and add the RDM again with type of your choice.

Wait. Did I just said delete? What about the data which was there. Well I was surprised too when I first read these steps on some blog, but later when I tested that in lab, I was assured that no data is lost.

When we delete the RDM HDD, we are just removing the descriptor files. The actual data is still stored on SAN LUN and is not impacted by deletion of the descriptor file.

Note: While configuring RDM’s, one should be mindful about the fact that the size of the mapping file equals to the size of the LUN. Although RDM LUN is obtained directly from SAN, the underlying datastore where the mapping file will be stored should have space greater then the size of RDM LUN.

I hope you find this post informational. Feel free to share this on social media if it is worth sharing. Be sociable 🙂