is /dev/dm-1 a partition or a whole block device?

Every partition is a "whole" block-device. You could sub-partition any partition, and then sub-partition it again, and again ...

In your example dm-1 could be mapped to anything, a raw device, a dmcrypt device abstraction, a logical volume on a MD-RAID-backed, multi-pathed, dm-crypted volume group.

The number dm-X basically was just an arbitrary free number when the device was initialized. On hosts without many changes in the block device layer during runtime these numbers are just allocated in natural order at bootup.

But most device mapper mechanisms also allow you to specify an alias for your mapping. Check out ls -l /dev/mapper/.

To then visualize the hierarchical relationships between block devices you can use the lsblk (List block-devices). Shortened example output below:

$ lsblk /dev/sdb
NAME                   MAJ:MIN  TYPE
sdb                      8:128  disk
├─sdb1                   8:129  part
└─sdb5                   8:133  part
  └─crypto (dm-0)        252:0  crypt
    ├─ubuntu-root (dm-1) 252:1  lvm
    └─ubuntu-swap (dm-2) 252:2  lvm

The lsblk command is a convenient way of displaying information about block devices including which device mapper device goes where.


For a given dm-x with major M, minor m, there is a corresponding /sys/dev/block/M:m/dm/uuid file. If the content of the uuid file starts with part, it is safe to assume it is a partition. The corresponding whole device is found in /sys/dev/block/M:n/slaves/. For instance:

[centos@try ~]$ cat /sys/dev/block/253:0/dm/uuid
mpath-353333330000007d0
[centos@try ~]$ cat /sys/dev/block/253:1/dm/uuid
part1-mpath-353333330000007d0
[centos@try ~]$ ls -l /sys/dev/block/253:1/slaves
total 0
lrwxrwxrwx. 1 root root 0 15 août  22:06 dm-0 -> ../../dm-0

/dev/dm-1 is for "device mapper n.1".

Basically, it is a logical unit carved out using the kernel embedded device mapper layer. From a userspace application point of view, it is a RAW block device.

Using pvs and lvdisplay we should be able to tell you the specific physical disk/partition backing it.