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 command to convert a virtual disk into a Raw Device Mapping (RDM) in an ESXi/ESX environment.

Environment

VMware ESXi 4.1.x Installable
VMware ESXi 4.0.x Embedded
VMware ESX 4.0.x
VMware vSphere ESXi 5.0
VMware ESXi 3.5.x Embedded
VMware ESX Server 3.0.x
VMware vSphere ESXi 5.1
VMware ESX Server 3.5.x
VMware vSphere ESXi 5.5
VMware vSphere ESXi 6.0
VMware ESX 4.1.x
VMware ESXi 3.5.x Installable
VMware ESXi 4.0.x Installable
VMware ESXi 4.1.x Embedded

Resolution

ESXi/ESX 4.x and ESXi 5.x/6.0

To import a virtual disk into a raw LUN for use with an RDM in ESXi/ESX 4.x and ESXi 5.x/6.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

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

Additional Information

For translated versions of this article, see: