Raw Device Mappings (RDM) under ESXi 5.10

From Leo's Notes
Last edited on 24 February 2017, at 19:14.

A Raw Device Mapping (RDM) is a method to map a VMWare Virtual Disk (VMDK) to a physical disk (rather than creating a .vmdk within a datastore).

To create a RDM, do:

  1. Login via SSH to your ESXi server
  2. Determine which disk you want to use for your RDM
    • ls -l /vmfs/devices/disks
  3. Go to the datastore your VM is under
    • cd /vmfs/volumes/datastore1/freebsd
  4. Create a new mapping [1]
    • vmkfstools -z /vmfs/devices/disks/*disk from step 2* disk1.vmdk

Note: the -z means that this will be as RDM pass through which does a physical remap rather than a logical remap (done by using -r).

Once created, you should now be able to add the new disk file (disk1.vmdk) to your VM via vSphere.

Example[edit | edit source]

 Disk /dev/disks/t10.ATA_____ST2000DM0012D9YN164__________________________________W1E0CMN4: 3907029168 sectors, 3726M
 Logical sector size: 512
 Disk identifier (GUID): db19b6d9-e6d1-11e1-acdc-00195b68e1a7
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 3907029134
 
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048      3906619567       3725M   0700  disk04
 Found valid GPT with protective MBR; using GPT
 
 Disk /dev/disks/t10.ATA_____ST3320820AS_____________________________5QF5T51S____________: 625142448 sectors,  596M
 Logical sector size: 512
 Disk identifier (GUID): e294c69e-7e4e-44c0-a028-29c63a324a14
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 625142414
 
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048       625137344        596M   0700
 Found valid GPT with protective MBR; using GPT
 
 Disk /dev/disks/t10.ATA_____ST2000DL0032D9VT166__________________________________5YD3VR3A: 3907029168 sectors, 3726M
 Logical sector size: 512
 Disk identifier (GUID): c8efc3cc-e6d1-11e1-acdc-00195b68e1a7
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 3907029134
 
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048      3906619567       3725M   0700  disk03
 Found valid GPT with protective MBR; using GPT
 
 Disk /dev/disks/t10.ATA_____WDC_WD20EARS2D00J99B0_________________________WD2DWCAWZ0840640: 3907029168 sectors, 3726M
 Logical sector size: 512
 Disk identifier (GUID): c6a22b24-e6d1-11e1-acdc-00195b68e1a7
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 3907029134
 
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048      3906619567       3725M   0700  disk01
 Found valid GPT with protective MBR; using GPT
 
 Disk /dev/disks/t10.ATA_____ST2000DM0012D9YN164__________________________________W2F0B1GV: 3907029168 sectors, 3726M
 Logical sector size: 512
 Disk identifier (GUID): c7715eb1-e6d1-11e1-acdc-00195b68e1a7
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 3907029134
 
 Number  Start (sector)    End (sector)  Size       Code  Name
    1            2048      3906619567       3725M   0700  disk02
 Found valid GPT with protective MBR; using GPT
 
 Disk /dev/disks/t10.ATA_____WDC_WD20EARS2D00J99B0_________________________WD2DWCAWZ0877352: 3907029168 sectors, 3726M
 Logical sector size: 512
 Disk identifier (GUID): 9bbee234-e6d1-11e1-acdc-00195b68e1a7
 Partition table holds up to 128 entries
 First usable sector is 34, last usable sector is 3907029134


 vmkfstools -z /vmfs/devices/disks/t10.ATA_____WDC_WD20EARS2D00J99B0_________________________WD2DWCAWZ0877352 Disk1-2TB.vmdk -a buslogic
 vmkfstools -z /vmfs/devices/disks/t10.ATA_____WDC_WD20EARS2D00J99B0_________________________WD2DWCAWZ0840640 Disk2-2TB.vmdk -a buslogic
 vmkfstools -z /vmfs/devices/disks/t10.ATA_____ST2000DM0012D9YN164__________________________________W2F0B1GV Disk3-2TB.vmdk -a buslogic
 vmkfstools -z /vmfs/devices/disks/t10.ATA_____ST2000DL0032D9VT166__________________________________5YD3VR3A Disk4-2TB.vmdk -a buslogic
 vmkfstools -z /vmfs/devices/disks/t10.ATA_____ST2000DM0012D9YN164__________________________________W1E0CMN4 Disk5-2TB.vmdk -a buslogic


Troubleshoot[edit | edit source]

When I tried to do the mapping under ESXi running in VMware Workstation 9.0.0, I get the following:

# vmkfstools -r /vmfs/devices/disks/mpx.vmhba1\:C0\:T1\:L0  /vmfs/volumes/516aeed2-1da6b04c-da91-000c29b7dcf7/FreeBSD\ 9.1/disk.vmdk -a lsilogic
Failed to create virtual disk: Invalid argument (1441801).

I believe that this fails because the virtual disk under VMWare Workstation doesn't support it (or something). When the same thing is done on a physical disk, it works without issue.