How can I map iostat device names to LVM /dev/mapper/XXX names?

Solution 1:

ls -l /dev/mapper/*, the device minor number (field 6 of what ls -l outputs) corresponds to the number in dm-\d+.

Solution 2:

Depending on the version of iostat you have the -N option will do this for you:

-N Display the registered device mapper names for any device mapper devices. Useful for viewing LVM2 statistics.

Edit: versions >= 7.1.4 of systat (which includes iostat) have that option.

2007/04/29: Version 7.1.4 - Sebastien Godard (sysstat wanadoo.fr) * Option -N added to iostat. This option enables the user to query any device-mapper devices for their registered device name [bugzilla #177540].

Solution 3:

you can try lsblk command which shows the Logical Volume used by respective dev-mapper.

# lsblk
NAME                       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                          8:0    0    8G  0 disk
├─sda1                       8:1    0  500M  0 part /boot
└─sda2                       8:2    0  7.5G  0 part
  ├─vg_root-lv_root (dm-0) 253:0    0  5.6G  0 lvm  /
  └─vg_root-lv_swap (dm-1) 253:1    0    2G  0 lvm  [SWAP]
sdb                          8:16   0  200M  0 disk
sdc                          8:32   0  1.5G  0 disk
sdd                          8:48   0  512M  0 disk
sde                          8:64   0    4G  0 disk
└─vg_root-lv_data (dm-2)   253:2    0  3.5G  0 lvm  /data1