World Library  
Flag as Inappropriate
Email this Article

Device mapper

Article Id: WHEBN0002583493
Reproduction Date:

Title: Device mapper  
Author: World Heritage Encyclopedia
Language: English
Subject: Logical Volume Manager (Linux), Dm-crypt, Dm-cache, Linux kernel, Cryptoloop
Collection: Device Mapper, Linux Kernel Features
Publisher: World Heritage Encyclopedia

Device mapper

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 LVM2, 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 Linux kernel, but the device mapper functionality is also available in both NetBSD and DragonFly BSD.[2][3]


  • Usage 1
  • Features 2
  • Applications 3
  • References 4
  • External links 5


Applications (like LVM2 and EVMS) that need to create new mapped devices talk to the device mapper via the 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 interactively—​or from shell scripts—​by using the utility.[5][6]

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


The position of the device mapper targets within various layers of the Linux kernel's storage stack.[8]

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.[1]

The following mapping targets are available:[1][5]

  • cache – allows creation of hybrid volumes, by using solid-state drives (SSDs) as caches for hard disk drives (HDDs)
  • crypt – provides data encryption, by using the Linux kernel's Crypto API
  • delay – delays reads and/or writes to different devices (used for testing)
  • era – behaves in a way similar to the linear target, while it keeps track of blocks that were written to within a user-defined period of time[9]
  • error – simulates I/O errors for all mapped blocks (used for testing)
  • flakey – simulates periodic unreliable behaviour (used for testing)
  • linear – maps a continuous range of blocks onto another block device
  • mirror – maps a mirrored logical device, while providing data redundancy
  • multipath – supports the mapping of multipathed devices, through usage of their path groups
  • raid – offers an interface to the Linux kernel's software RAID driver (md)
  • snapshot and snapshot-origin – used for creation of LVM snapshots, as part of the underlining copy-on-write scheme
  • striped – strips the data across physical devices, with the number of stripes and the striping chunk size as parameters
  • zero – an equivalent of /dev/zero, all reads return blocks of zeros, and writes are discarded


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

  • LVM2 – logical volume manager for the Linux kernel
  • dm-crypt – mapping target that provides volume encryption
  • dm-cache – mapping target that allows creation of hybrid volumes
  • dm-log-writes – mapping target that uses two devices, passing through the first device and logging the write operations performed to it on the second device[10]
  • dm-verity – validates the data blocks contained in a file system against a list of cryptographic hash values, developed as part of the Chromium OS project[11]
  •  – provides access to "fake" RAID configurations via the device mapper
  • DM Multipath – provides I/O failover and load-balancing of block devices within the Linux kernel
  • Linux version of TrueCrypt
  • DRBD (Distributed Replicated Block Device)
  •  – utility called from hotplug upon device maps creation and deletion
  • EVMS (deprecated)
  • cryptsetup – utility used to conveniently setup disk encryption based on dm-crypt
  • Docker – uses device mapper to create copy-on-write storage for software containers


  1. ^ a b c "Logical Volume Manager Administration, Appendix A. The Device Mapper".  
  2. ^ "NetBSD Kernel Interfaces Manual: dm(4)". 2008-08-30. Retrieved 2015-01-25. 
  3. ^ "DragonFly On-Line Manual Pages: dm(4)". 2010-07-28. Retrieved 2014-06-06. 
  4. ^ "libdevmapper.h". Retrieved 2013-09-29. 
  5. ^ a b "dmsetup(8) - Linux man page". Retrieved 2013-10-22. 
  6. ^ "Logical Volume Manager Administration". Appendix A.2. The dmsetup Command.  
  7. ^ "Device-mapper Resource Page". Retrieved 2013-09-29. 
  8. ^ Werner Fischer; Georg Schönberger (2015-06-01). "Linux Storage Stack Diagram". Thomas-Krenn.AG. Retrieved 2015-06-08. 
  9. ^ "6. Block layer". Linux kernel 3.15. 2014-06-08. Retrieved 2014-06-15. 
  10. ^ "Linux kernel documentation: Documentation/device-mapper/log-writes.txt".  
  11. ^ Jonathan Corbet (2011-09-19). "dm-verity".  

External links

  • Device mapper home at Red Hat
  • "Right To Your Own Devices".  – an article illustrating the use of various device mapper targets  
  • userspace tool to set up software RAID using various RAID metadata formats
  • Multipath support in the device mapper,, February 23, 2005, by Jonathan Corbet
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.