Device-mapper is a very important component of Linux 2.6 kernel. It is used for many critical storage related applications, such as LVM2, Linux native multipath tool device-mapper-multipath, device-mapper software RAID, etc. A solid understanding of device-mapper helps system administrators to investigate various kinds of issues with these applications.
In the Linux kernel, the device-mapper is a generic framework to map one block device into another. It is not just for LVM2. By using device-mapper, the kernel provides general services to dm-multipath, LVM2 and EVMS, device-mapper software RAIDs, dm-crypt disk encryption and offers additional features such as file system snapshots.
In the Linux kernel, the device-mapper is a generic framework to map one block device into another. It is not just for LVM2. By using device-mapper, the kernel provides general services to dm-multipath, LVM2 and EVMS, device-mapper software RAIDs, dm-crypt disk encryption and offers additional features such as file system snapshots.
In device-mapper architecture there are three important concepts to be familiarized
- 1. Mapped Device
- 2. Mapping Table
- 3. Target Device
Mapped device is a logical device provided by device-mapper driver. It provides an interface to operate on. The logical volumes in LVM2 and pseudo disks in dm-multipath are good examples of mapped devices.
Mapping Table
Mapping table represents a mapping from a mapped device to target devices. One table can be seen as an group of variables including mapped device’s starting address, length and target device’s physical device, starting address, length. The unit used here is a sector (512 bytes). The command “dmsetup create” will create such a table with parameters provided.
Target Device
Target device is a modularized plugin. The device-mapper filters and redirects I/O requests with it. some good examples for target device:
- linear for LVM2
- mirror for RAID
- stripped for LVM2
- snapshot for LVM2
How application deals with device mapper
Device-mapper works by processing data passed in from a virtual block device, that it itself provides, and then passing it on to another block device.
Applications (like dm_multipath and LVM2) that want 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.
Comments
Post a Comment