A.2. The dmsetup Command
dmsetupcommand is a command line wrapper for communication with the Device Mapper. For general system information about LVM devices, you may find the
depsoptions of the
dmsetupcommand to be useful, as described in the following subsections.
For information about additional options and capabilities of the
dmsetupcommand, see the
dmsetup(8) man page.
A.2.1. The dmsetup info Command
dmsetup info devicecommand provides summary information about Device Mapper devices. If you do not specify a device name, the output is information about all of the currently configured Device Mapper devices. If you specify a device, then this command yields information for that device only.
dmsetup infocommand provides information in the following categories:
- The name of the device. An LVM device is expressed as the volume group name and the logical volume name separated by a hyphen. A hyphen in the original name is translated to two hyphens. During standard LVM operations, you should not use the name of an LVM device in this format to specify an LVM device directly, but instead you should use the vg/lv alternative.
- Possible device states are
dmsetup suspendcommand sets a device state to
SUSPENDED. When a device is suspended, all I/O operations to that device stop. The
dmsetup resumecommand restores a device state to
- The number of data blocks that the system reads ahead for any open file on which read operations are ongoing. By default, the kernel chooses a suitable value automatically. You can change this value with the
--readaheadoption of the
- Possible states for this category are
INACTIVEstate indicates that a table has been loaded which will be swapped in when a
dmsetup resumecommand restores a device state to
ACTIVE, at which point the table's state becomes
LIVE. For information, see the
- The open reference count indicates how many times the device is opened. A
mountcommand opens a device.
- The current number of events received. Issuing a
dmsetup wait ncommand allows you to wait for the n'th event, blocking the call until it is received.
- Major and minor device number.
Number of targets
- The number of segments that make up a device. For example, a linear device spanning 3 disks would have 3 targets. A linear device composed of the beginning and end of a disk, but not the middle would have 2 targets.
- UUID of the device.
The following example shows partial output for the
dmsetup infoName: testgfsvg-testgfslv1 State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 0 Event number: 0 Major, minor: 253, 2 Number of targets: 2 UUID: LVM-K528WUGQgPadNXYcFrrf9LnPlUMswgkCkpgPIgYzSvigM7SfeWCypddNSWtNzc2N ... Name: VolGroup00-LogVol00 State: ACTIVE Read Ahead: 256 Tables present: LIVE Open count: 1 Event number: 0 Major, minor: 253, 0 Number of targets: 1 UUID: LVM-tOcS1kqFV9drb0X1Vr8sxeYP0tqcrpdegyqj5lZxe45JMGlmvtqLmbLpBcenh2L3
A.2.2. The dmsetup ls Command
You can list the device names of mapped devices with the
dmsetup lscommand. You can list devices that have at least one target of a specified type with the
dmsetup ls --target target_typecommand. For other options of the
dmsetup lscommand, see the
The following example shows the command to list the device names of currently configured mapped devices.
dmsetup lstestgfsvg-testgfslv3 (253:4) testgfsvg-testgfslv2 (253:3) testgfsvg-testgfslv1 (253:2) VolGroup00-LogVol01 (253:1) VolGroup00-LogVol00 (253:0)
The following example shows the command to list the device names of currently configured mirror mappings.
dmsetup ls --target mirrorlock_stress-grant--02.1722 (253, 34) lock_stress-grant--01.1720 (253, 18) lock_stress-grant--03.1718 (253, 52) lock_stress-grant--02.1716 (253, 40) lock_stress-grant--03.1713 (253, 47) lock_stress-grant--02.1709 (253, 23) lock_stress-grant--01.1707 (253, 8) lock_stress-grant--01.1724 (253, 14) lock_stress-grant--03.1711 (253, 27)
LVM configurations that are stacked on multipath or other device mapper devices can be complex to sort out. The
dmsetup lscommand provides a
--treeoption that displays dependencies between devices as a tree, as in the following example.
dmsetup ls --treevgtest-lvmir (253:13) ├─vgtest-lvmir_mimage_1 (253:12) │ └─mpathep1 (253:8) │ └─mpathe (253:5) │ ├─ (8:112) │ └─ (8:64) ├─vgtest-lvmir_mimage_0 (253:11) │ └─mpathcp1 (253:3) │ └─mpathc (253:2) │ ├─ (8:32) │ └─ (8:16) └─vgtest-lvmir_mlog (253:4) └─mpathfp1 (253:10) └─mpathf (253:6) ├─ (8:128) └─ (8:80)
A.2.3. The dmsetup status Command
dmsetup status devicecommand provides status information for each target in a specified device. If you do not specify a device name, the output is information about all of the currently configured Device Mapper devices. You can list the status only of devices that have at least one target of a specified type with the
dmsetup status --target target_typecommand.
The following example shows the command to list the status of the targets in all currently configured mapped devices.
dmsetup statustestgfsvg-testgfslv3: 0 312352768 linear testgfsvg-testgfslv2: 0 312352768 linear testgfsvg-testgfslv1: 0 312352768 linear testgfsvg-testgfslv1: 312352768 50331648 linear VolGroup00-LogVol01: 0 4063232 linear VolGroup00-LogVol00: 0 151912448 linear
A.2.4. The dmsetup deps Command
dmsetup deps devicecommand provides a list of (major, minor) pairs for devices referenced by the mapping table for the specified device. If you do not specify a device name, the output is information about all of the currently configured Device Mapper devices.
The following example shows the command to list the dependencies of all currently configured mapped devices.
dmsetup depstestgfsvg-testgfslv3: 1 dependencies : (8, 16) testgfsvg-testgfslv2: 1 dependencies : (8, 16) testgfsvg-testgfslv1: 1 dependencies : (8, 16) VolGroup00-LogVol01: 1 dependencies : (8, 2) VolGroup00-LogVol00: 1 dependencies : (8, 2)
The following example shows the command to list the dependencies only of the device
dmsetup deps lock_stress-grant--02.17223 dependencies : (253, 33) (253, 32) (253, 31)