On Linux, LVM is a volume management system that uses the kernel device mapper. Basically, physical volumes contain metadata that describe how blocks of data on a physical volume should be mapped to create a device mapper block device.
LVM is not the only thing that uses the device mapper, you can create mapped volumes manually with dmsetup
, LUKS is another system that uses the device mapper, etc.
device mapper devices are given a name. By convention, LVM uses "vg-lv" and have a major and minor device number just like any block device. The device name (as in what appears in /sys/class/block
) is dm-n
where n is the device minor number.
For convenience, udev creates a symlink in /dev/mapper
with the device mapper name associated with it. And if that device mapper device also happens to be a LVM logical volume, then the LVM subsystem also adds a /dev/vg/lv symlink to it.
A similar thing happens for other block devices, where you have /dev/disk/by-id
, /dev/disk/by-path
... for convenience.
Because the dm-1
, dm-10
... may be different for a same device from one boot to the next. It's handy to have a different name that only depends on permanent characteristics of the device (like the volume name stored in the LVM header) instead of that minor number which only the kernel cares about.