Translate

Total Pageviews

My YouTube Channel

Friday 2 January 2015

Identifying virtual disks pointing to Raw Device Mappings (RDMs) (1005937)

Purpose

This article provides advanced users with a method to list all of the virtual disks pointing to a physical disk (Raw Device Mapping, or RDM) from PowerCLI and from the ESX/ESXi host console.
This method does not explicitly state the virtual machine which is using the raw device mapping pointer file, though it can be inferred from the directory name. It will instead provide the LUN to RDM mapping. To obtain a list of registered virtual machines and the associated RDMs, see Identifying virtual machines with Raw Device Mappings (RDMs) using PowerCLI (2001823).
Note: This method is generally time-consuming, as all Datastores must be searched iteratively for VMDK files. If those VMDK files are locked, such as by a running virtual machine, inquiring for the target device fails. In this case, it is better to search for registered virtual machines.

Resolution

To list all virtual disks pointing to an RDM device using PowerCLI:

This operation is generally time-consuming, as PowerCLI must iteratively inquire about the disk type of every VMDK file on the remote hosts. Checking locked files adds a few seconds of delay. The device which the RDM points to cannot be determined without a virtual machine attached.
  1. Open the vSphere PowerCLI command-line. For more information, see the vSphere PowerCLI Documentation.
  2. Run the command:

    Get-Datastore | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select "Filename","CapacityKB" | fl

    Example output:

    Filename    : [DatastoreName] DirectoryName/virtualrdm.vmdk
    CapacityKB  : 5760

    Note: The mapped device is not exposed, only the existence of the RDM. To determine the target device which it is mapped to, add this virtual disk to a virtual machine or use the console method.

To list all virtual disks pointing to an RDM device using the local console:

This operation is generally quick, as there is no overhead of network communication.
  1. Open a console to the ESX or ESXi host. For more information, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807) or Using Tech Support Mode in ESXi 4.1 (1017910).
  2. Run the command:

    #find /vmfs/volumes/ -type f -name '*.vmdk' -size -1024k -exec grep -l '^createType=.*RawDeviceMap' {} \; > /tmp/rdmsluns.txt

    #for i in `cat /tmp/rdmsluns.txt`; do vmkfstools -q $i; done


    Example output:

    • Virtual Mode RDM:

      Disk /vmfs/volumes/.../virtualrdm.vmdk is a Non-passthrough Raw Device Mapping
      Maps to: vml.02000000006006048000019030091953303030313253594d4d4554
    • Physical Mode RDM:

      Disk /vmfs/volumes/.../physicalrdm.vmdk is a Passthrough Raw Device Mapping
      Maps to: vml.02000000006006048000019030091953303030313253594d4d4554

    Note: For more information on identifying the mapped device, see Identifying disks when working with VMware ESX/ESXi (1014953).

Additional Information

Note: This process may be useful before engaging in a resignaturing process. For more information about resignaturing, see Resignaturing VMFS3 volumes on VMware ESX 3.x via the VMware Infrastructure Client (9453805).
 
To query a specific virtual disk pointing to an RDM device using the local console, run the command:
 # vmkfstools –q <path_to_rdm_vmdk>
 
For example:
# vmkfstools –q  /vmfs/volumes/mydatastore/myvm/physicalrdm.vmdk
Disk /vmfs/volumes/.../physicalrdm.vmdk is a Passthrough Raw Device Mapping
Maps to: vml.02000000006006048000019030091953303030313253594d4d4554
 
Source KB:-
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1005937&src=vmw_so_vex_ragga_1012

No comments:

Post a Comment