Converting a virtual disk into a Raw Device Mapping
search cancel

Converting a virtual disk into a Raw Device Mapping

book

Article ID: 325341

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides the commands to convert a virtual disk (VMDK) into a Raw Device Mapping (RDM) for either a virtual or physical RDM in an ESXi environment.

Environment

VMware ESXi (All Versions)

Resolution

 

To import a virtual disk into a raw LUN for use with an RDM in ESXi/ESX 6.x and ESXi 7.x/8.0:

  1. Log into the ESX host as root via the console or an SSH session
  2. Run the command:

    # esxcfg-mpath -L

    The output appears similar to:

    vmhba33:C0:T0:L0 state:active naa.6090a#######################909b vmhba33 0 0 0 NMP active san iqn.1998-01.com.vmware:bs-tse-i137-35c1bf18 00023d000001,iqn.2001-05.com.equallogic:0-8a0906-516ecdf03-9b9000004644a365-bs-lab-vc40,t,1

  3. Make note of the LUN number (highlighted in red) and the identifier (highlighted in blue).

    Note: The disk identifiers may vary depending on the platform or tool you are using. For more information, see KB Identifying disks when working with VMware ESXi

  4. Run the appropriate command for either the virtual or physical compatibility mode:

    • For virtual compatibility mode, run the command:

      # vmkfstools –i srcfile -d rdm:/vmfs/devices/disks/identifier /vmfs/volumes/datastore/vmdir/vmname.vmdk

      Note: The identifier value represents the value recorded in step 3.

      For example:

      # vmkfstools -i olddisk.vmdk -d rdm:/vmfs/devices/disks/naa.0600034392874872788777273 /vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk

    • For physical compatibility mode, run the command:

      # vmkfstools –i srcfile -d rdmp:/vmfs/devices/disks/identifier /vmfs/volumes/datastore/vmdir/vmname.vmdk

      Note: The identifier value represents the value recorded in step 3.

      For example:

      # vmkfstools -i olddisk.vmdk -d rdmp:/vmfs/devices/disks/naa.0600034392874872788777273 /vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk