18

mount shows mount devices like:

/dev/mapper/VolGroup01-LogVol00 on /var type ext3 (rw)

or

/dev/mapper/VolGrp_backups-backups on /mnt/backups type ext3 (rw)

but

iostat uses dm- notation. like dm-0, dm-1 and so on.

Where can I find a way to know which is which?

  • Somehow, I thought there was a way to tell iostat to 'just do that', but there isn't one (that I can find). +1 for a great question that got an answer that helped me too. – Tim Post May 17 '11 at 17:16

7 Answers7

22

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

Tim Post
  • 1,515
  • 13
  • 25
womble
  • 95,029
  • 29
  • 173
  • 228
13

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].

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47
4

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
Sven
  • 97,248
  • 13
  • 177
  • 225
Faiz Sayed
  • 41
  • 1
1

Please try this command in version of iostat where there is no -N option to list the LV's

lvdisplay | awk '/LV Name/{blockdev=$3} /Block device/{bdid=$3; sub("[0-9]*:","dm-",bdid); print bdid,blockdev;}'

Aaron Copley
  • 12,345
  • 5
  • 46
  • 67
user202677
  • 11
  • 1
1

The correct and easiest way to do it is to use the following command:

iostat -Nd

From the man page of iostat, the option -N already displays the registered device mapper names.

0

You can use a simple lvdisplay with awk, like this.

lvdisplay | awk '/LV Name/{n=$3} /Block device/{d=$3; sub(".*:","dm-",d); print d,n;}'
chicks
  • 3,639
  • 10
  • 26
  • 36
0

Cleanest, simplest output: ls -lrt /dev/mapper

Gaia
  • 1,777
  • 4
  • 32
  • 58