Creating Raw Device Mappings

Posted on Sun 08 January 2017 in Virtualization

What is an RDM?

A Raw Device Mapping, can be thought of as a proxy for a physical disk. With ESXI, an RDM is a .vmdk file on a vmfs volume, that points to the physical disk.

Often you'll use RDM's where performance is needed. The VM, database or whatever else resides on the RDM is not governed by the speed or capability of the vmfs volume. You're literally giving the VM physical access to the disk.

As an example, I use one vmfs datastore to store my VMs and 12 disks for storage, grouped using Drive Pool in Windows. For the pool to operate, DrivePool needs to be able to see the disks, so I pass them through, via RDMs to the VM.

I could group together all the disks in one vmfs volume, then create vmdk's as disks and present them. This causes me two issues;

One: ESXi has trouble with + 2TB disks. Regardless of GPT/MBR a 4TB disk just wont play well.

Two: Drive Pool wont work with vmfs's well, it'll create a write bottleneck, speeds drop considerably. I've tried.

Using Drive Pool means I'm working soley with NTFS partitions, recovery, disk replacements, usage - a breeze. I've been there. Sadly.

I've used ESXi 5.1 and 5.5, there are some slight differences in the commands, I'll try to point them out.

Creating the RDM

Assuming all of your disks are attached() and you have a working datastore: Quick one on attaching disks, wipe and format them NTFS.

I've never been able to pass through a disk with active partitions. Format clean NTFS.

  • Open up a terminal to your ESXi box
  • Type:  cd /dev/disks
  • Type: ls -lh (give it the -lh or it'll be unreadable)

This will list your currently attached disks, it'll look somethig like this:

alt text

In red are the disks, sectioned by disk in green, note the partitions.

Take a note of the disk ID. vml.01 in my case.

Type: cd/vmfs/volumes Type: ls -lh

This is where your datastores reside, mines called DS01.

alt text

  • CD in to your datastore

To create the RDM:

  • Type: vmkfstools -z /vmfs/devices/disks/ /.vmdk

Mine looks like this:

ESXi 5.5 vmkfstools -r /vmfs/devices/disks/vml.01000000002020202020202020202020205731463057533058535433303030 3TbRMDWSOX.vmdk -a lsilogi

ESXi 5.1 vmkfstools -z /vmfs/devices/disks/vml.01000000002020202020202020202020205731463057533058535433303030 3TbRMDWSOX.vmdk

I've omitted the location as I want the .vmdk to reside on the datastore, hence the CD to the datastore.

If all goes well it'll just return prompt.

Add the disk to the Virtual Machine

  • Login to your vSphere client
  • Edit a VMs settings
  • Hardware, Click Add
  • Hard Disk
  • Use an existing disk
  • Navigate to your datastore, find the named.vmdk file
  • Wait for the console to add the disk

Power up your VM, via Windows disk management > add disk. Linux, mount the disk.