Device mapper

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Template:Short description 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 interactivelyTemplate:Mdashbor from shell scriptsTemplate:Mdashbby using the Template:Man utility.[5][6]

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

Features

File:The Linux Storage Stack Diagram.svg
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]

Template:As of, the following mapping targets are available:[1][5]

  • cacheTemplate:Snd allows creation of hybrid volumes, by using solid-state drives (SSDs) as caches for hard disk drives (HDDs)
  • cloneTemplate:Snd will permit usage before a transfer is complete.
  • cryptTemplate:Snd provides data encryption, by using the Linux kernel's Crypto API
  • delayTemplate:Snd delays reads and/or writes to different devices (used for testing)
  • eraTemplate:Snd 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]
  • errorTemplate:Snd simulates I/O errors for all mapped blocks (used for testing)
  • flakeyTemplate:Snd simulates periodic unreliable behaviour (used for testing)
  • linearTemplate:Snd maps a continuous range of blocks onto another block device
  • mirrorTemplate:Snd maps a mirrored logical device, while providing data redundancy
  • multipathTemplate:Snd supports the mapping of multipathed devices, through usage of their path groups
  • raidTemplate:Snd offers an interface to the Linux kernel's software RAID driver (md)
  • snapshot and snapshot-originTemplate:Snd used for creation of LVM snapshots, as part of the underlying copy-on-write scheme
  • stripedTemplate:Snd stripes the data across physical devices, with the number of stripes and the striping chunk size as parameters
  • thin Template:Snd allows creation of devices larger than the underlying physical device, physical space is allocated only when written to
  • zeroTemplate:Snd an equivalent of /dev/zero, all reads return blocks of zeros, and writes are discarded

Script error: No such module "anchor".Applications

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

References

Template:Reflist

External links

Template:Linux kernel Script error: No such module "Navbox". Template:Operating system

  1. a b c Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".Template:Dead link
  5. a b Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "citation/CS1".
  8. Script error: No such module "citation/CS1".
  9. Script error: No such module "citation/CS1".
  10. Script error: No such module "citation/CS1".
  11. Script error: No such module "citation/CS1".
  12. Script error: No such module "citation/CS1".
  13. Script error: No such module "citation/CS1".
  14. Script error: No such module "citation/CS1".