127

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.

1
  • 2
    It 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.
    – user4491
    Apr 16, 2010 at 21:15

10 Answers 10

134

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

3
  • 60
    More specifically sudo dmsetup info /dev/dm-0
    – tgharold
    Dec 30, 2015 at 13:13
  • 4
    dmsetup ls does not return any useful information on what the dm-0 is, or where it can be found.
    – karatedog
    Sep 18, 2019 at 13:18
  • In my case the number after the : on each line matched the number in dm-0
    – Dark
    Nov 18, 2020 at 17:08
59

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/

41

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  /
1
  • 1
    Were these devices created by LVM?
    – Melab
    Sep 10, 2020 at 13:56
18
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).

0
18

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 
1
  • 3
    awesome, much easier to pinpoint KNAMEs on exact devices, thanks
    – Alexander
    Apr 25, 2018 at 20:33
12

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

3

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
2
  • 1
    df -h worked on Android for me Mar 20, 2020 at 12:26
  • Thanks, sar is the only non-root option that showed what these mean.
    – Timmmm
    Aug 25 at 9:37
1

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

iostat -x -d 1
0

I got the requested information on CentOS 7 by first listing LVM volume groups with vgs:

# vgs
VG     #PV #LV #SN Attr   VSize  VFree
centos   1   3   0 wz--n- <1.82t 4.00m

And then simply listing ls -l /dev/centos:

# ls -l /dev/centos
lrwxrwxrwx. 1 root root 7 Jun 23 09:26 home -> ../dm-2
lrwxrwxrwx. 1 root root 7 Jun 23 09:26 root -> ../dm-0
lrwxrwxrwx. 1 root root 7 Jun 23 09:26 swap -> ../dm-1
0

Since the title of the question is still "What is this dm-0 device", it should be mentioned atleast once that dm-X (dm-0, etc) are not always LVM related. More directly, they are part of the "device mapper" system which is used by LVM but, for example, in my case some kind of strange happening from osprobe and/or update-grub created them.

dm-X devices showed up in my /dev/ folder and were causing problems since the devices they pointed to were raid members and when the raid was assembled through them it was read only. I came to this SU question trying to find out "What are these dm-X" devices, and it lead me to believe I somehow had slipped on a banana peel and ended up with an LVM setup that I never intentially created.

After I verified there was no actual LVM in use because the outputs of pvs lvs pvsetup and lvsetup all returned absolutely nothing, I just used the dmsetup command to remove the device mappings like dmsetup remove /dev/dm-0

After this the problems it was causing were resolved, and I could use my devices normally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy