Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Converting a virtual disk into a Raw Device Mapping (3443266)

Details

This article provides the command to convert a virtual disk into a Raw Device Mapping (RDM) in an ESXi/ESX environment.

Solution

ESXi/ESX 3.x

To import a virtual disk into a raw LUN for use with an RDM in ESXi/ESX 3.x:
  1. Log into the ESX host as root via the console or an SSH session, or log into ESXi technical support mode. For more information on Tech Support Mode, see Tech Support Mode for Emergency Support (1003677).
  2. Run the command:

    # esxcfg-mpath -l

    The output appears similar to:

    Disk vmhba2:0:3 /dev/sdb (409594MB) has 2 paths and policy of Most Recently Used
    FC 16:0.0 2100001b32010007<->500805f300124a91 vmhba2:0:3 On active preferred
    FC 16:0.0 2100001b32010007<->500805f300124a99 vmhba2:1:3 On


  3. Make note of the identifier (highlighted in red in the example above).

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

  4. Run the appropriate command for either the virtual or physical compatibility mode:
  5. To confirm Select the virtual machine you are working with from the vSphere Client.

    Select the Virtual Machine > Edit Setting

    Highlight the virtual Raw Device Mapping (RDM) disk and copy the vm.id. 

        

    For example your VM-ID is :  


    VM-ID : vml.020007000060060160c66030003c784fe4a808e211565241494420


    To identify the the device and NAS ID. From a SSH or Console session type the command:


    # ls -l /vmfs/devices/disks | grep vml.020007000060060160c66030003c784fe4a808e211565241494420

    You should see a output similar to this example:

    ls -l /vmfs/devices/disks | grep vml.020007000060060160c66030003c784fe4a808e211565241494420
    lrwxrwxrwx 1 root root 36 Feb 20 16:08 vml.020007000060060160c66030003c784fe4a808e211565241494420 -> naa.60060160c66030003c784fe4a808e211
    lrwxrwxrwx 1 root root 38 Feb 20 16:08 vml.020007000060060160c66030003c784fe4a808e211565241494420:1 -> naa.60060160c66030003c784fe4a808e211:1

    For detailed information on identification of disks please see the above note.

    For virtual compatibility mode, run the command:

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

      Note: The identifier value represents the value recorded in step 3. The partition represents the partition on that LUN.

      For example:

      # vmkfstools -i olddisk.vmdk -d rdm:/vmfs/devices/disks/vmhba3:0:2 /vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk

    • For physical compatibility mode, run the command:

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

      Note: The identifier value represents the value recorded in step 3. The partition represents the partition on that LUN.

      For example:

      # vmkfstools -i olddisk.vmdk -d rdmp:/vmfs/devices/disks/vmhba3:0:2 /vmfs/volumes/TestDatastore/TestVM/rdmdisk.vmdk

ESXi/ESX 4.x and ESXi 5.0

To import a virtual disk into a raw LUN for use with an RDM in ESXi/ESX 4.x and ESXi 5.0:
  1. Log into the ESX host as root via the console or an SSH session, or log into ESXi technical support mode. For more information on Tech Support Mode, see Tech Support Mode for Emergency Support (1003677).
  2. Run the command:

    # esxcfg-mpath -L

    The output appears similar to:

    vmhba33:C0:T0:L0 state:active naa.6090a038f0cd6e5165a344460000909b 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 Identifying disks when working with VMware ESX (1014953).

  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

Update History

10/16/2012 - Added ESXi 5.0 to Products 11/29/2013 - Added ESXi 5.5 to Products

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 28 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 28 Ratings
Actions
KB: