What is this dm-0 device?

102

33

While poking around trying to figure out why a Linux -> Linux file transfer is running slower than I think it should, I stumbled across something I'm not familiar with. /dev/dm-0 seems to be my bottleneck, but I have no idea what it is.

On my destination server, the iostat command shows a device at the bottom, /dev/dm-0, as being 100% utilized. This server has 6 disks in a mdadm raid5 set, with LVM running on top of it. Each of the underlying disks are sitting around 50% util. The transfer is writing to a logical volume located on this raidset.

What is this /dev/dm-0 thing? Once I know what it is, maybe I can find how to increase its speed, or at least understand why its the speed that it is.

Jeff Shattock

Posted 2010-04-16T01:18:09.840

Reputation: 1 798

1It turns out that the dm-0 device wasn't causing the slowness, I had the partitions aligned wrong. On a 4k sector drive, you need to manually align the partitions when you create them. Dumb, but easy to fix. – Jeff Shattock – 2010-04-16T21:15:26.100

Answers

109

It's part of the device mapper in the kernel, used by LVM. Use dmsetup ls to see what is behind it.

Ignacio Vazquez-Abrams

Posted 2010-04-16T01:18:09.840

Reputation: 100 516

40More specifically sudo dmsetup info /dev/dm-0 – tgharold – 2015-12-30T13:13:47.283

dmsetup ls does not return any useful information on what the dm-0 is, or where it can be found. – karatedog – 2019-09-18T13:18:57.750

47

Those are LVM logical "devices"

You can map them using:

# sudo lvdisplay|awk  '/LV Name/{n=$3} /Block device/{d=$3; sub(".*:","dm-",d); print d,n;}'
dm-0 /dev/SysVolGroup/LogVolRoot
dm-1 /dev/SysVolGroup/xen
dm-2 /dev/SysVolGroup/db1-2
dm-3 /dev/SysVolGroup/db1-2swap
dm-4 /dev/SysVolGroup/python1
dm-5 /dev/SysVolGroup/python1swap
dm-6 /dev/SysVolGroup/db1-2snap

source: http://www.linuxquestions.org/questions/linux-newbie-8/dm0-in-iostat-652771/

gulden PT

Posted 2010-04-16T01:18:09.840

Reputation: 571

32

As usual under a Linux system, there should be many ways to get the same result. If you've been given a non root user, I advise you to use lsblk command (e.g. list block devices) which will build a tree view of disks dependencies:

[oracle@abcdlinux ~]$ lsblk
NAME                               MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                  8:0    0  300G  0 disk
└─RATGORA1DSY_PJSTORE_1 (dm-4)     253:4    0  300G  0 mpath
  └─RATGORA1DSY_PJSTORE_1p1 (dm-5) 253:5    0  300G  0 part  /oradata
sdb                                  8:16   0  100G  0 disk
└─Boot-RATGORA1DSY (dm-0)          253:0    0  100G  0 mpath
  ├─Boot-RATGORA1DSYp1 (dm-1)      253:1    0  100M  0 part  /boot
  ├─Boot-RATGORA1DSYp2 (dm-2)      253:2    0   16G  0 part  [SWAP]
  └─Boot-RATGORA1DSYp3 (dm-3)      253:3    0 83.9G  0 part  /
sdc                                  8:32   0  300G  0 disk
└─RATGORA1DSY_PJSTORE_1 (dm-4)     253:4    0  300G  0 mpath
  └─RATGORA1DSY_PJSTORE_1p1 (dm-5) 253:5    0  300G  0 part  /oradata
sdd                                  8:48   0  100G  0 disk
└─Boot-RATGORA1DSY (dm-0)          253:0    0  100G  0 mpath
  ├─Boot-RATGORA1DSYp1 (dm-1)      253:1    0  100M  0 part  /boot
  ├─Boot-RATGORA1DSYp2 (dm-2)      253:2    0   16G  0 part  [SWAP]
  └─Boot-RATGORA1DSYp3 (dm-3)      253:3    0 83.9G  0 part  /

Pascal

Posted 2010-04-16T01:18:09.840

Reputation: 331

17

sudo lvdisplay

showed the mapping of mounted virtual partitions to "volume groups".

When I typed sudo pvs I saw the mapping of a volume group to a "physical volume" that looked like a familiar /dev/sdaN notation. (My looking at the whole disk with fdisk -l /dev/sda showed another partition).

eel ghEEz

Posted 2010-04-16T01:18:09.840

Reputation: 280

11

pvs displays the physical volumes that underpin the LVM volume group. A number of physical devices can be grouped together to from one volume group. The group is then re-split into logical volumes as required treating the physical disks as a single resource to be chopped up and re-sized at will. Each time you slice of part of the volume group as a logical volume it is presented as a dm- device

Rob

Posted 2010-04-16T01:18:09.840

Reputation: 111

9

I wanted to comment on Pascal's post, sometimes you need to define the output columns to see the name. For example on CentOS 6 it displays them but CentOS 7 doesn't. Using --output resolves this.

lsblk --output NAME,KNAME,TYPE,SIZE,MOUNTPOINT

NAME            KNAME TYPE  SIZE MOUNTPOINT
sda             sda   disk   16G 
├─sda1          sda1  part  500M /boot
└─sda2          sda2  part 15.5G 
  ├─centos-root dm-0  lvm  13.9G /
  └─centos-swap dm-1  lvm   1.6G [SWAP]
sr0             sr0   rom  1024M 

Box293

Posted 2010-04-16T01:18:09.840

Reputation: 91

2awesome, much easier to pinpoint KNAMEs on exact devices, thanks – Alexander – 2018-04-25T20:33:41.937

1

You could also use iostat for the purpose of identifying possible bottlenecks, for example:

iostat -x -d 1

Dennis Schulze

Posted 2010-04-16T01:18:09.840

Reputation: 11

1

You can use sar

df -h

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-rootvol
                   24G  4.1G   18G  19% /
tmpfs                 7.8G     0  7.8G   0% /dev/shm
/dev/mapper/VolGroup01-appvol
                   39G  411M   37G   2% /app
/dev/sda1             194M   93M   92M  51% /boot
/dev/mapper/VolGroup01-logvol
                   61G   18G   41G  30% /log
/dev/mapper/VolGroup00-tmpvol
                  2.0G  379M  1.5G  21% /tmp
/dev/mapper/VolGroup00-varvol
                   20G  2.1G   17G  12% /var

sar -bdp 1

01:00:20 AM       DEV       tps  rd_sec/s  wr_sec/s  avgrq-sz  avgqu-sz         await     svctm     %util
01:00:21 AM       sda      0.00      0.00      0.00      0.00      0.00              0.00      0.00      0.00
01:00:21 AM VolGroup00-swapvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:00:21 AM VolGroup00-rootvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:00:21 AM VolGroup01-appvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:00:21 AM VolGroup01-logvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:00:21 AM VolGroup00-varvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
01:00:21 AM VolGroup00-tmpvol      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

karthik

Posted 2010-04-16T01:18:09.840

Reputation: 11