How to determine which /dev/mapper/ device corresponds to /dev/dm-* device in CentOS/RHEL

When native Linux device multipathing is used, an error may be reported that lists the composite multipath device. For example:

[root@server ~]# lvs
  /dev/dm-9: read failed after 0 of 4096 at 0: Input/output error

The error message identifies /dev/dm-9, which is the composite device. The message does not identify the physical device which encountered the error.

To determine which /dev/mapper entry corresponds to this /dev/dm-* entries, run the following ls command:

[root@server ~]# ls -l /dev/dm-9
brw-r----- 1 root disk 252,  9 Oct 16 00:54 /dev/dm-9

and then examining the friendly names for these devices:

[root@server ~]# ls -l /dev/mapper/*
brw-rw---- 1 root disk 252,   9 Oct 16 00:54 /dev/mapper/backup
brw-rw---- 1 root disk 252,  10 Oct 16 00:54 /dev/mapper/home
brw-rw---- 1 root disk 252,  12 Oct 16 00:54 /dev/mapper/log
brw-rw---- 1 root disk 252,  11 Oct 16 00:54 /dev/mapper/stage

The fifth and sixth fields are the device major and minor numbers; this pair uniquely identifies each device. For the /dev/dm-9 query, we find the pair 252,9 as the system device. By examining the listing of the friendly names we can see that 252,9 pair associated with the /dev/mapper/backup name. Using the final component of the name (“backup”) the name can be found in the /etc/multipath.conf file. With that name, the UUID for the physical device can be found if necessary to drill down to a physical device, these UUID can be located using the blkid(8) utility.