Device mapper explained

The device mapper is a framework provided by the Linux kernel for mapping physical block devices onto higher-level virtual block devices. It forms the foundation of the logical volume manager (LVM), software RAIDs and dm-crypt disk encryption, and offers additional features such as file system snapshots.[1]

Device mapper works by passing data from a virtual block device, which is provided by the device mapper itself, to another block device. Data can be also modified in transition, which is performed, for example, in the case of device mapper providing disk encryption or simulation of unreliable hardware behavior.

This article focuses on the device mapper implementation in the Linux kernel, but the device mapper functionality is also available in both NetBSD and DragonFly BSD.[2] [3]

Usage

Applications (like LVM2 and Enterprise Volume Management System (EVMS)) that need to create new mapped devices talk to the device mapper via the libdevmapper.so shared library, which in turn issues ioctls to the /dev/mapper/control device node.[4] Configuration of the device mapper can be also examined and configured interactivelyor from shell scriptsby using the utility.[5] [6]

Both of these two userspace components have their source code maintained alongside the LVM2 source.[7]

Features

Functions provided by the device mapper include linear, striped and error mappings, as well as crypt and multipath targets. For example, two disks may be concatenated into one logical volume with a pair of linear mappings, one for each disk. As another example, crypt target encrypts the data passing through the specified device, by using the Linux kernel's Crypto API.

, the following mapping targets are available:

Applications

Linux kernel features and projects built on top of the device mapper include the following:

External links

Notes and References

  1. Web site: Logical Volume Manager Administration, Appendix A. The Device Mapper . 2013-09-29 . Red Hat.
  2. Web site: NetBSD Kernel Interfaces Manual: dm(4) . 2008-08-30 . 2015-01-25 . netbsd.gw.com . 2014-07-19 . https://web.archive.org/web/20140719152701/http://netbsd.gw.com/cgi-bin/man-cgi?dm+4+NetBSD-current . dead .
  3. Web site: DragonFly On-Line Manual Pages: dm(4) . 2010-07-28 . 2014-06-06 . dragonflybsd.org.
  4. Web site: libdevmapper.h . 2013-09-29 . sourceware.org .
  5. Web site: dmsetup(8) - Linux man page . 2013-10-22 . man.cx.
  6. Web site: Logical Volume Manager Administration . Appendix A.2. The dmsetup Command . 2013-09-29 . Red Hat.
  7. Web site: Device-mapper Resource Page . 2013-09-29 . sourceware.org.
  8. Web site: 6. Block layer . Linux kernel 3.15 . 2014-06-08 . 2014-06-15 . kernelnewbies.org.
  9. Web site: dm-integrity . 2018-04-30 . 2018-05-08 . cryptosetup project.
  10. Web site: dm-integrity target . 2017-05-13 . 2018-05-08 . kernel.org.
  11. Web site: cryptsetup - manage plain dm-crypt and LUKS encrypted volumes . 2018-01-01 . 2018-05-08.
  12. Web site: Linux kernel documentation: Documentation/device-mapper/log-writes.txt . 2015-05-29 . 2015-10-13 . kernel.org.
  13. Web site: dm-verity . 2011-09-19 . 2015-10-13 . Jonathan Corbet . LWN.net.