What is RDM?
The VMware VMFS filesystem supports a special type of file. This file, an RDM, is a mechanism for a virtual machine to have direct access to a LUN on the SAN. This LUN can be formatted in any way desired, without the need to format it to VMFS and place a VMDK on it. This removes two additional layers of complexity (the VMFS and the VMDK).
How RDM Works?
An RDM is a symbolic link from a VMFS volume to a raw LUN. The mapping makes LUNs appear as files in a VMFS volume. The mapping file, not the raw LUN, is referenced in the virtual machine configuration. The mapping file acts as a proxy for a raw physical device. This file contains metadata for managing and redirecting disk access.
When a LUN is opened for access, the mapping file is read to obtain the reference to the raw LUN. Thereafter, reads and writes go directly to the raw LUN rather than going through the mapping file.
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.
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.
Virtual Compatibility Mode
Virtual mode for an RDM specifies full virtualization of the mapped device. It appears to the guest operating system exactly the same as a virtual disk file in a VMFS volume. The real hardware characteristics are hidden.
- It allows VMFS features such as advanced file locking and snapshots.
- It also presenting the same behavior as a virtual disk file.
- When you clone the disk, make a template out of it, or migrate it (if the migration involves copying the disk), the contents of the LUN is into a virtual disk (.vmdk) file.
Physical Compatibility Mode
In physical mode, the VMkernel passes all SCSI commands to the device, with one exception: the REPORT LUNs command is virtualized, so that the VMkernel can isolate the LUN for the owning virtual machine. Otherwise, all physical characteristics of the underlying hardware are exposed. “Physical mode is useful to run SAN management agents or other SCSI target based software in the virtual machine”. It allows virtual-to-physical clustering for cost-effective high availability.
- LUNs attached to powered-on virtual machines and configured for physical compatibility cannot be migrated
- If the migration involves copying the disk. Such LUNs cannot be cloned or cloned to a template either.
- You cannot create a snapshot of a Physical Compatibility Mode RDM.
- No NFS and local storage is supported. You need a VMFS datastore to store the mapping file.
- You cannot enable Fault Tolerance for a VM using a Physical Compatibility mode RDM.
- VCB cannot backup a RDM in Physical Compatibility mode.
- VMware Data Recovery cannot backup a RDM in Physical Compatibility mode.
- No partition mapping – RDM requires the mapped device to be a whole LUN.
- When using VMware vCenter Site Recovery Manager, make sure you include both the raw LUN as well as the VMFS datastore holding the mapping file to SAN replication schedules. Placing the mapping file alongside the VMX file is highly recommended.
- VMware vCenter Server does not support LUN number changes within the target. When a LUN number changes, the vml identifier does not change accordingly. Remove and rebuild the RDM to generate a new vml ID that the LUN recognizes as a workaround.
- The maximum size of an RDM is 2TB minus 512 bytes. Use the Microsoft iSCSI initiator and MPIO inside the VM when you need more than 2TB on a disk
- you would want to use RDMs is in the case of a clustering service, such as Microsoft Clustering Services, Heartbeat and Novell Clustering Services
- Allow NPIV technology that allows a single Fiber Channel HBA port to register with the Fiber Channel fabric using several worldwide port names (WWPNs).
- The RDM can be beneficial for performance reasons. This is due to the fact that a typical VMFS datastore is shared by multiple virtual machines. Some applications might have specific I/O requirements and might be critical enough to require guaranteed I/O. An RDM is presented directly to a single virtual machine and cannot be used by any other virtual machine;
Procedure to use RDM:
I am going to skip some step below. Because you all knew, how to create VM. I will just show only the steps which relevant for RDM.
FROM: vSphere Classic Client
Start the VM Creation Wizard. Select “Custom” Option.
Select the datastore for VM files.
Select “Raw Device Mapping” Option as Disk type as highlighted. Make sure you have a free block (ISCSI, FC) device LUN has been available in order to use this option.
If there is not free LUN is available then “RDM Mapping” option is grated out as heighted below.
In my case, I have created a brand new LUN on my storage for RDM testing as show below. Choose the LUN and click “Next”
Choose the datastore for RDM LUN mapping. Default option is recommended; if you want choose the different option. You have the ability to do so. In my case my virtual machine files are going to store at “ISCSI1_Datastore”. You can see above on the second screenshot.
NOTE: No NFS and local storage is supported. You need a VMFS datastore to store the mapping file.
Choose the Capability in my case I choose “Virtual”, default one is “physical”. For more information what does this capabilities meaning you can read from start of this article.
Following are the VM properties, which we have, created for RDM Testing
FROM: vSphere Web client
Start the VM creation Wizard. Select your “VM Datastore”.
From new device select “RDM Disk” -> Click “Add”
Select the LUN for RDM. Click “OK”
Now RDM disk has been added as shown below
Expend the “Newly Added hard disk”. You have multiple options available as highlighted below.
Check the VM Summary -> Click “Finish”
Final “VM Settings”
VM is ready now. You may install the OS which you used to install in ESXi.
If you SSH on to the ESXi host, hosted by VM and List the “vmdk” files of the RDM VM then you will find the below highlighted details.