Linux/Device Mapper: Difference between revisions

From Omnia
Jump to navigation Jump to search
 
(No difference)

Latest revision as of 19:20, 25 June 2014

Device Mapper

"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.

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

Linux Multipath

See also Linux/Multipath

dmsetup

Device-mapper resource page: http://sources.redhat.com/dm/

dmsetup - low level logical volume management

Creates a device:

echo "0 $(blockdev --getsize /dev/fioa) linear /dev/fioa 0" | dmsetup create fioa

List device names (and major/minor device numbers):

dmsetup ls

Note: the minor numbers determine the name of the dm device. Example: (253, 3) -> /dev/dm-3

List device status:

dmsetup status

Remove device:

dmsetup remove fioa

Details:

dmsetup ls --tree         # also list source devices by major/minor device number
dmsetup info              # show device state, and number of targets
dmsetup info [DM_DEVICE]
dmsetup deps              # list source devices by major/minor device number
dmsetup deps [DM_DEVICE]
dmsetup status            # space separated table of various details
dmsetup status [DM_DEVICE]
dmsetup table             # space separated table of various details
dmsetup table [DM_DEVICE]

Note: With dmsetup, there doesn't appear to be a way to get the source device, other than by major/minor device number. Yuck.

Alternative ways to match dm device to /dev/device:

multipath -l
ls /sys/block/dm-0/slaves
cat /proc/partitions

Help:

dmsetup help

keywords

linux multipath multi path multipathd kpartx dmsetup

[[Category::Linux]]