# How to Identify the LUN ID Associated with an Instance Volume

## Problem

To identify the LUN ID on the backend storage that corresponds to a particular instance (VM) volume. This is useful for troubleshooting, storage mapping, and validating multipath connectivity.

## Environment

* Private Cloud Director Virtualization - v2025.4 and Higher
* Private Cloud Director Kubernetes – v2025.4 and Higher
* Self-Hosted Private Cloud Director Virtualization - v2025.4 and Higher
* Component - Storage / Block Storage (Cinder, Multipath, LUN Mapping)

## Procedure

1. List the VM’s attached volumes

Run the following command on the compute node hosting the VM:

```
$ virsh domblklist <DOMAIN_ID>
```

{% code title="Example" %}

```bash
$ virsh domblklist vm-101

Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/vm1.qcow2
vdb        /dev/disk/by-id/dm-name-mpathcq
```

{% endcode %}

The above command lists all block devices (disks) attached to the specified VM and shows their mapping to host devices.

In the above example output, we can see vdb is a block device mapped via multipath.

2. Obtain the WWID of the multipath device

Identify the multipath name from Step 1 (mpathcq) and run:

```
$ multipath -ll | grep -A5 <DM-NAME>
```

{% code title="Example" %}

```bash
$ multipath -ll | grep -A5 mpathcq

mpathcq (123123123123123abc25abc) dm-9 3PARdata,VV
size=50G features='1 queue_if_no_path' hwhandler='1 alua' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 0:0:1:2  sdv  65:80   active ready running
  |- 2:0:3:2  sdab 65:176  active ready running
  |- 0:0:0:2  sdz  65:144  active ready running
```

{% endcode %}

* The WWID is `123123123123123abc25abc` (this uniquely identifies the volume).
* The devices (sdv, sdab, sdz) show their `Host:Channel:Target:LUN (H:C:T:L)` tuples.

3. Identifying the LUN ID from above output

* In the tuples 0:0:1:**2** , 2:0:3:**2** , 0:0:0:**2** → the last number = LUN ID.
* So, this volume maps to LUN ID 2 on the storage backend.

4. We can also cross check using by-path

   ```
   $ ls -l _dev_disk_by-path_ | grep <DEVICE-NAME>
   ```

{% code title="Example" %}

```bash
$ ls -l _dev_disk_by-path_ | grep sdv

lrwxrwxrwx 1 root root  9 Aug 20 10:15 pci-0000:3b:00.0-fc-0x1235000abc-lun-2 -> .._.._sdv
```

{% endcode %}

Output will show a symlink including lun-2, confirming the backend LUN mapping.

## Additional Information

* In the SCSI address format `Host:Channel:Target:LUN (H:C:T:L)` , the last digit (L) represents the LUN ID.
* `virsh domblklist` helps you trace which device (e.g., /dev/dm-\*) is attached to a VM.
* `multipath -ll` maps that device to its WWID and shows the backend paths, where you can identify the LUN ID.
* `/dev/disk/by-path/` provides human-readable symlinks, including names like lun-\<N>, making it easier to confirm the LUN number.
