Jump to content

Device mapper: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m copyedit
Silver163 (talk | contribs)
No edit summary
Line 7: Line 7:
}}</ref>
}}</ref>


Device mapper works by passing data from a virtual [[block device]] (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.
Device mapper works by passing data from a virtual [[block device]] (provided by the device mapper itself) to another block device through a proxy mapper. Data can be also modified in transition, which is performed, for example, in the case of device mapper providing disk encryption or disk emulation.


== Usage ==
== Usage ==
Line 46: Line 46:
* '''snapshot''' and '''snapshot-origin''': used for creation of LVM snapshots, as part of the underlining copy-on-write scheme
* '''snapshot''' and '''snapshot-origin''': used for creation of LVM snapshots, as part of the underlining copy-on-write scheme
* '''zero''': equivalent of <code>/dev/zero</code> &mdash; all reads return blocks of zeros, and writes are discarded
* '''zero''': equivalent of <code>/dev/zero</code> &mdash; all reads return blocks of zeros, and writes are discarded
* '''zero zero''': provides the rezeroing of new normals of a disk
* '''multipath''': supports the mapping of [[Multipath I/O|multipathed]] devices, through usage of their path groups
* '''multipath''': supports the mapping of [[Multipath I/O|multipathed]] devices, through usage of their path groups
* '''[[dm-crypt|crypt]]''': provides data encryption, by using the Linux kernel's [[Crypto API (Linux)|Crypto API]]
* '''[[dm-crypt|crypt]]''': provides data encryption, by using the Linux kernel's [[Crypto API (Linux)|Crypto API]]

Revision as of 20:02, 29 May 2014

The device mapper is a Linux kernel framework for mapping block devices onto higher-level virtual block devices. It forms the foundation of LVM2, software RAIDs, 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 (provided by the device mapper itself) to another block device through a proxy mapper. Data can be also modified in transition, which is performed, for example, in the case of device mapper providing disk encryption or disk emulation.

Usage

Applications (like LVM2 and 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.[2] Configuration of the device mapper can be also examined and configured interactively — or from shell scripts — by using the dmsetup(8) utility.[3][4]

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

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

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

  • linear: maps a continuous range of blocks onto another block device
  • striped: strips the data across physical devices, with the number of stripes and the striping chunk size as parameters
  • mirror: mapping of a mirrored logical device, providing data redundancy
  • snapshot and snapshot-origin: used for creation of LVM snapshots, as part of the underlining copy-on-write scheme
  • zero: equivalent of /dev/zero — all reads return blocks of zeros, and writes are discarded
  • zero zero: provides the rezeroing of new normals of a disk
  • multipath: supports the mapping of multipathed devices, through usage of their path groups
  • crypt: provides data encryption, by using the Linux kernel's Crypto API
  • cache: allows creation of hybrid drives, by using SSDs as caches for hard drives
  • raid: offers an interface to the Linux kernel's software RAID driver (md)
  • error: simulates I/O errors for all mapped blocks (used for testing)
  • flakey: simulates periodic unreliable behaviour (used for testing)
  • delay: delays reads and/or writes to different devices (used for testing).

Applications

The following features and projects are relying on the device mapper:

References

  1. ^ a b c "Logical Volume Manager Administration". Appendix A. The Device Mapper. Red Hat. Retrieved 2013-09-29.
  2. ^ "libdevmapper.h". sourceware.org. Retrieved 2013-09-29.
  3. ^ a b "dmsetup(8) - Linux man page". man.cx. Retrieved 2013-10-22.
  4. ^ "Logical Volume Manager Administration". Appendix A.2. The dmsetup Command. Red Hat. Retrieved 2013-09-29.
  5. ^ "Device-mapper Resource Page". sourceware.org. Retrieved 2013-09-29.